Bloquear DDoS con .htaccess

Hola, viendo que muchos script de DDoS usan el mismo método:

http://urlatirar.com/?1234567890
http://urlatirar.com/?0.1234567890
http://urlatirar.com/?pepe=1?1234567890
http://urlatirar.com/?pepe=1?0.1234567890

(números aleatorios)

Vamos a usar .htaccess para bloquear el DDoS. Solo tenemos que agregar este code al inicio del .htaccess


Enviar el ataque a la IP del usuario!

RewriteEngine on
RewriteCond %{QUERY_STRING} ^([0-9]+)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+)(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^([0-9]+\.[0-9])(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+\.[0-9])(.*)$ [NC]
RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [L]

Enviar el ataque al referer (de donde proviene el ataque)!

RewriteEngine on
RewriteCond %{QUERY_STRING} ^([0-9]+)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+)(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^([0-9]+\.[0-9])(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+\.[0-9])(.*)$ [NC]
RewriteRule ^(.*)$ %{HTTP_REFERER} [L]

Enviar el ataque a un sitio especifico!

RewriteEngine on
RewriteCond %{QUERY_STRING} ^([0-9]+)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+)(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^([0-9]+\.[0-9])(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+\.[0-9])(.*)$ [NC]
RewriteRule ^(.*)$ http://sitioaregresarddos.com/ [L]

Todos los codes funcionan bien. y solo son efectivos con este tipo de ataque!

Saludos!

Deja un comentario