Вредоносный .htaccess как избавиться от заразы ?

TF-Studio
На сайте с 17.08.2010
Offline
334
#41

тег PHP режет теги, через цитату или просо код скиньте, пожалуйста.

Всё ещё лучший способ заработка для белых сайтов: GoGetLinks (https://www.gogetlinks.net/?inv=fahbn8).
pepsicolla
На сайте с 07.10.2012
Offline
57
#42
TF-Studio:
тег PHP режет теги, через цитату или просо код скиньте, пожалуйста.

######################################## START PROTECT
###################################################
php_flag display_errors On
# No Signature
ServerSignature Off
# Enable mod rewrite
RewriteEngine On
############### WP Section ##############################
RewriteRule ^wp-content/plugins/secure-contact/mkimg.php - [L]
RewriteRule ^wp-includes/js/tinymce/wp-tinymce.php - [L]
RewriteRule ^wp-content/.*\.php\d* - [F]
RewriteRule ^maindir/.*\.php\d* - [F]
RewriteRule ^wp-includes/.*\.php\d* - [F]

########## Begin - No directory listings
IndexIgnore *
Options -Indexes

########## Begin - File execution order, by Komra.de
DirectoryIndex index.php index.html

########## Begin - Common hacking tools and bandwidth hoggers block
SetEnvIf user-agent "Indy Library" stayout=1
#SetEnvIf user-agent "Wget" stayout=1
SetEnvIf user-agent "libwww-perl" stayout=1
SetEnvIf user-agent "Download Demon" stayout=1
SetEnvIf user-agent "GetRight" stayout=1
SetEnvIf user-agent "GetWeb!" stayout=1
SetEnvIf user-agent "Go!Zilla" stayout=1
SetEnvIf user-agent "Go-Ahead-Got-It" stayout=1
SetEnvIf user-agent "GrabNet" stayout=1
SetEnvIf user-agent "TurnitinBot" stayout=1

deny from env=stayout

########## Begin - Rewrite rules to block out some common exploits
# If the request query string contains /proc/self/environ (by SigSiu.net)
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
# Block out any script trying to base64_encode or base64_decode data
within the URL
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]
## IMPORTANT: If the above line throws an HTTP 500 error, replace it
with these 2 lines:
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]

# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
########## End - Rewrite rules to block out some common exploits

########## Begin - File injection protection, by SigSiu.net
RewriteCond %{REQUEST_METHOD} GET
# to put some exceptions
#RewriteCond %{QUERY_STRING} ![a-zA-Z0-9_]=http://yoursite\.ru/
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=https:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=ftp:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
# CustomLog insert-path-and-name-of-log common env=bad-range
RewriteRule .* - [F]

########## Begin - Basic antispam Filter, by SigSiu.net
## This code will NOT work with Apache 1.x servers.

# RewriteCond %{QUERY_STRING}
\b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]
# RewriteCond %{QUERY_STRING}
\b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b
[NC,OR]
# RewriteCond %{QUERY_STRING}
\b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b
[NC,OR]
# RewriteCond %{QUERY_STRING}
\b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]

# RewriteRule .* - [F]

########## Begin - Advanced server protection - query strings,
referrer and config
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine
## your PHP version). See http://www.0php.com/php_easter_egg.php and
## http://osvdb.org/12184 for more information
RewriteCond %{QUERY_STRING}
\=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]
RewriteCond %{QUERY_STRING} ^(%2d|-)[^=]+$ [NC]
RewriteCond %{QUERY_STRING} ^(%2d|\-)[^=]+$ [NC]
RewriteRule .* - [F]

## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html
## May cause problems on legitimate requests
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]
# CustomLog insert-path-and-name-of-log common env=bad-range
RewriteRule .* - [F]

#### More
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]

#RewriteCond %{HTTP_REFERER} (<|>|-|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
#RewriteCond %{HTTP_COOKIE} (<|>|-|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
#RewriteCond %{HTTP_USER_AGENT} (<|>|-|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]


RewriteCond %{HTTP_REFERER} ^(.*)(<|>|Б─≥|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
RewriteCond %{HTTP_COOKIE} ^.*(<|>|Б─≥|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
RewriteCond %{REQUEST_URI}
^/(,|;|:|<|>|Б─²>|Б─²<|/|\\\.\.\\).{0,9999}.* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]
RewriteCond %{HTTP_USER_AGENT}
(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner)
[NC,OR]
RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]


RewriteCond %{QUERY_STRING} proc\/self\/environ [NC,OR]
RewriteCond %{QUERY_STRING} etc\/passwd [NC,OR]

#Block mySQL injects
RewriteCond %{QUERY_STRING}
(;|<|>|-|б╕|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|information_schema|union|delete|select|insert|cast|set|concat_ws|file_priv|load_file|aes_decrypt|unhex|aes_encrypt|declare|drop|update|md5|benchmark)
[NC,OR]
RewriteCond %{QUERY_STRING} \.\./\.\. [OR]
RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} (<|>|-|%0A|%0D|%27|%3C|%3E|%00) [NC]
# CustomLog insert-path-and-name-of-log common env=bad-range
RewriteRule .* - [F]

# drop Range header when more than 5 ranges.
#SetEnvIf Range (,.*?){5,} bad-range=1
#RequestHeader unset Range env=bad-range
# CustomLog insert-path-and-name-of-log common env=bad-range

# XSS Protection
#Header set X-Frame-Options DENY
#Header set X-XSS-Protection "1; mode=block"
#Header set X-Content-Security-Policy "allow 'self';"
#Header set X-Content-Type-Options "nosniff"

# multiple file types
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|sql)$">
Order Allow,Deny
Deny from all
</FilesMatch>
########################## END ######################################

Держите...

Пруф http://sigsiu.net/presentations/fortifying_your_joomla_website.html

Реклама: Просто отличный хостинг (http://u.to/9_fuBA)

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий