Sponsored Content
Special Forums Cybersecurity [Linux] Blocking Your w00tw00ts with iptables Post 302411834 by Er_Davids on Friday 9th of April 2010 02:03:36 PM
Old 04-09-2010
Im having problems with these fucking lammers bots. I have a dedicated server and I was having problems 2 months ago with my Internet Bandwith. I know now that I have this fucking bot:

Quote:
203.127.11.215 - - [09/Apr/2010:19:23:19 +0200] "GET /w00tw00t.at.ISC.SANS.test0Smilie HTTP/1.1" 400 341 "-" "-"
217.195.204.194 - - [09/Apr/2010:19:30:59 +0200] "GET /w00tw00t.at.ISC.SANS.DFindSmilie HTTP/1.1" 400 341 "-" "-"
203.127.11.215 - - [09/Apr/2010:19:38:19 +0200] "GET /w00tw00t.at.ISC.SANS.test0Smilie HTTP/1.1" 400 341 "-" "-"
217.195.204.194 - - [09/Apr/2010:19:47:44 +0200] "GET /w00tw00t.at.ISC.SANS.DFindSmilie HTTP/1.1" 400 341 "-" "-"
203.127.11.215 - - [09/Apr/2010:19:53:05 +0200] "GET /w00tw00t.at.ISC.SANS.test0Smilie HTTP/1.1" 400 341 "-" "-"
As you said, I banned lot of IP's at httpd.conf but didnt work because IPs change. Then I was looking for info and I got that its a scanner.

Now my problem is that Im a Newbiee at Linux (using Ubuntu 8.04 at moment), and I only got a script done by other people, but It doesnt work for me cause of some parameters:

Quote:
#!/bin/bash

# agregue las siguientes líneas al principio de las reglas de iptables

# Aceptar loopback
iptables -A INPUT -i lo -j ACCEPT

# Comprobando que la IP está en la lista negra de w00tlist
# Si la IP está en la lista se rechaza de inmediato y se actualiza la lista negra en 6 horas
iptables -A INPUT -p tcp -m recent --name w00tlist --update --seconds 21600 -j DROP

# Crear una cadena w00tchain que agregue la dirección IP a la Lista negra de w00tlist
# y se restablecerá la conexión (no se olvide del prámetro '-p tcp' necesario para el uso de '--reject-with tcp-reset')
iptables -N w00tchain
iptables -A w00tchain -m recent --set --name w00tlist -p tcp \ -j REJECT --reject-with tcp-reset

# Creamos nuestra cadena w00t:
iptables -N w00t

# redirigimos los paquetes TCP a nuestro canal:
iptables -A INPUT -p tcp -j w00t

################################################## ###
# Ponga aquí sus propias reglas de iptables:
# Aceptar conexiones establecidas, etc. un ejemplo en la primera línea:

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
...
...
...
...

################################################## ###

# Cadena w00t
# Buscar el primer SYN y crear la lista:
iptables -A w00t -m recent -p tcp --syn --dport 80 --set

# Buscar los paquetes SYN, ACK, y actualización de la lista:
iptables -A w00t -m recent -p tcp --tcp-flags PSH,SYN,ACK SYN,ACK --sport 80 --update

# Buscar el paquete ACK y actualización de la lista:
iptables -A w00t -m recent -p tcp --tcp-flags PSH,SYN,ACK ACK --dport 80 --update

# Busca la firma hexadecimal en el primer PSH+ACK.
# Si está presente, se redirije a la lista negra de w00tchain y
# se corta la conexión de la IP.
# Y se elimina de nuestra lista, que no queremos filtrar cualquier paquete adicional de la conexión
iptables -A w00t -m recent -p tcp --tcp-flags PSH,ACK PSH,ACK --dport 80 --remove \ -m string --to 80 --algo bm --hex-string '|485454502f312e310d0a0d0a|' -j w00tchain
Problems are with -j and -m parameters. If someone can make 1 script for me that avoid this fucking scanner, I will be so thank.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

LINUX 9 IPTABLES and DNS

I have installed a linux 9 router/firewall and have issues with outside DNS queries making it in. here are my IPTABLE rules, can anyone make some suggestions? ETH1 is my outside facing Interface, ETH0 is my inside facing interface. Accept If input interface is not eth1 Accept If protocol is... (1 Reply)
Discussion started by: frankkahle
1 Replies

2. Linux

LINUX 9 IPTABLES and DNS

I have installed a linux 9 router/firewall and have issues with outside DNS queries making it in. here are my IPTABLE rules, can anyone make some suggestions? ETH1 is my outside facing Interface, ETH0 is my inside facing interface. Accept If input interface is not eth1 Accept If protocol... (6 Replies)
Discussion started by: frankkahle
6 Replies

3. UNIX for Dummies Questions & Answers

Linux IPTABLES help

I'm new to Linux and I made a big mistake at work recently locking myself out of our own server :(. I did iptables -F first as the tutorial said and then entered the rules. I wanted to start over again so I did iptables -F and it locked us out. We had to get someone to physically restart... (0 Replies)
Discussion started by: nogumo
0 Replies

4. Programming

Linux BSD sockets blocking issue

I am using BSD TCP sockets under Debian Linux 2.6 and no matter what I do, the socket blocks on recv. I have set O_NONBLOCK and O_NDELAY using fcntl to no effect. Any ideas ? (3 Replies)
Discussion started by: johnmb
3 Replies

5. Shell Programming and Scripting

Non-blocking pipe

Hello, Would this be an acceptable way of creating a non-blocking pipe. Basically I want to create kind of a server client arch. This code would be in the server, and I don't want to have to wait for clients to read before moving on to the next client. One problem I can see is if... (4 Replies)
Discussion started by: cdlaforc
4 Replies

6. Debian

URL blocking with iptables

we have internal network 192.168.129.x for a system hosted with pdf.xxx.xyz URL is already public accessible but when try to connect as site (/ap/p.nt) of the URL pdf.xxx.xyz/ap/p.nt restriction to be applied publicly except accessing internally can anyone guide me on this?? (1 Reply)
Discussion started by: shrinuvas
1 Replies

7. UNIX for Advanced & Expert Users

ps blocking

Hi Folks I have been debugging a script that is called every thirty seconds. Basically it is doing a ps, well two actually, one to file (read by the getline below) and the other into a pipe. The one into the pipe is: - V_SYSVPS=/usr/sysv/bin/ps $V_SYSVPS -p$PIDLIST -o$PSARGS... (0 Replies)
Discussion started by: steadyonabix
0 Replies

8. UNIX for Dummies Questions & Answers

Linux iptables -> is it possible?

Hi! I have a dedicated hosting working with 2 ips. Is it possible to block all connections but 1 in all existing ports for only 1 of my ips? I mean like, I have 2 ips for example: 190.x.x.5 and 190.x.x.6 I want that all the connections going to 190.x.x.6 in all ports get rejected but only 1... (7 Replies)
Discussion started by: Kekox
7 Replies

9. Programming

Which are blocking and non-blocking api's in sockets in C ?

among the below socket programming api's, please let me know which are blocking and non-blocking. socket accept bind listen write read close (2 Replies)
Discussion started by: VSSajjan
2 Replies

10. Cybersecurity

Blocking 3306 with iptables -A INPUT -p tcp --dport 3306

Just added these lines to our server firewall: iptables -A INPUT -p tcp --dport 3306 -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT iptables -A INPUT -p tcp --dport 3306 -j DROP Even though mysql is configured to correctly only listen on port 127.0.0.1 we still see these mysql log file notes on a daily... (0 Replies)
Discussion started by: Neo
0 Replies
All times are GMT -4. The time now is 03:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy