Skip to contentSkip to conversation

new tcp connections, without SYN

DISCUSSION Carlos Ble 3 participants 4 messages Apr 9, 2003

lore
Share & tools
lore

Carlos Ble

author
#0 lore raw

Hi all. Two days ago, i added the policy that drops all new tcp connections that starts without SYN to prevent port scaners and other attacks:

iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \
--log-prefix "NEW tcp try no SYN:"
iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP

Now the system is registering this event every minute from diferents ip. Is this usual?. What kind of programs tries to start a new tcp connection without a SYN ?.
Im no so worried because scaning the ports of my server from another computer in the internet, using nmap , the answer is that all ports al filtered.

Another question: I had disabled the icmp answers :
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts to try to be "invisible" for some wicked programs . will i have problems with some other programas that makes ping before establish a connection?

Thanks in advance

#1 lore raw
Quoted 5 lines · Carlos Ble

Hi all. Two days ago, i added the policy that drops all new tcp connections that starts without SYN to prevent port scaners and other attacks:
iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \
--log-prefix "NEW tcp try no SYN:"
iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP

You can add RELATED state to this :

	iptables -A bad_tcp_packets -p tcp ! --syn -m state \
		--state NEW,RELATED -j DROP
Quoted 6 lines

Another question: I had disabled the icmp answers :
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts to try to be "invisible" for some wicked programs . will i have problems with some other programas that makes ping before establish a connection?

If a program waits for a ping reply before attempting connection, sure you'll have problems. You can mitigeate this issue dealing echo requests with your ruleset, and so having some addresses that still can ping.

Signature · 4 lines
Cédric Blancher  <[email protected]>
IT systems and networks security - Cartel Sécurité
Phone : +33 (0)1 44 06 97 87 - Fax: +33 (0)1 44 06 97 99
PGP KeyID:157E98EE  FingerPrint:FA62226DA9E72FA8AECAA240008B480E157E98EE
#2 lore raw
Quoted 8 lines · Cedric Blancher
Quoted 6 lines · Carlos Ble

Hi all. Two days ago, i added the policy that drops all new tcp connections
that starts without SYN to prevent port scaners and other attacks:
iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \
--log-prefix "NEW tcp try no SYN:"
iptables -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP

Quoted 4 lines

You can add RELATED state to this :

	iptables -A bad_tcp_packets -p tcp ! --syn -m state \
		--state NEW,RELATED -j DROP

That doesn't necessarily help though.

Our firewall also has a 'new, not syn' filter and it gets hit a LOT. On average about 20% of all blocked packets. Another 20% are unexpected RSTs (i.e. RST that's cannot be mapped to a RELATED or ESTABLISHED connection.)

It has been like this for quite some months, and everything works as expected but we never found the cause of these new not syns and unexpected resets.

(Yes, related traffic _is_ properly accepted, so that can't be the case.)

Signature · 1 line
Martijn
#3 lore raw
Quoted 5 lines · Martijn Klingens
Quoted 3 lines

You can add RELATED state to this :

	iptables -A bad_tcp_packets -p tcp ! --syn -m state \
		--state NEW,RELATED -j DROP

That doesn't necessarily help though.

Well, this is not intended to reduce the amount of packets getting blocked by this very rule. It was just to enforce the fast that a RELATED TCP packet should be a SYN one.

Quoted 5 lines

Our firewall also has a 'new, not syn' filter and it gets hit a LOT. On average about 20% of all blocked packets. Another 20% are unexpected RSTs (i.e. RST that's cannot be mapped to a RELATED or ESTABLISHED connection.) It has been like this for quite some months, and everything works as expected but we never found the cause of these new not syns and unexpected resets.

On our plateform, our Netfilter boxes also block a large amount of such packets. Most of them are destined to web servers we're hosting. My analysis, mainly based on reverse OS fingerprinting, is that thoses packets are mainly generated by IE, which is known to break some TCP rules, beginning some connections with an ACK to speed things up, and sometimes seems to reuse to quickly client ports (and thus generates SYN packets with ESTABLISHED flag).

See Martin Josefsson's post within "new tcp connections, without SYN" thread.

So, well, we just have to cope with this situation...

Signature · 4 lines
Cédric Blancher  <[email protected]>
IT systems and networks security - Cartel Sécurité
Phone : +33 (0)1 44 06 97 87 - Fax: +33 (0)1 44 06 97 99
PGP KeyID:157E98EE  FingerPrint:FA62226DA9E72FA8AECAA240008B480E157E98EE