Linux Netfilter discussions
 help / color / mirror / Atom feed
* Port Scan Detection
@ 2011-05-04 21:16 netfilter
  2011-05-04 22:42 ` Jan Engelhardt
  0 siblings, 1 reply; 2+ messages in thread
From: netfilter @ 2011-05-04 21:16 UTC (permalink / raw)
  To: netfilter

I have seen these rules used to detect a port scan:

iptables -A INPUT -i $INTERFACE --proto tcp --tcp-flags SYN,ACK,FIN,RST
RST -j LOG --log-prefix "PORT SCAN: " --log-level 6
iptables -A INPUT -i $INTERFACE --proto tcp --tcp-flags SYN,ACK,FIN,RST
RST -j DROP

It seems to me that this is a legitimate TCP flag combination, unless
I'm reading the rule wrong.  When I add them to the top of my ruleset
with other invalid TCP Flag rules, the above two rules  seem to fire
fairly frequently.  What about this rule detects a port scan?  I have a
rule that accepts established and related states.  The rules seem to
fire mostly on legitimate ldap connections.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Port Scan Detection
  2011-05-04 21:16 Port Scan Detection netfilter
@ 2011-05-04 22:42 ` Jan Engelhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2011-05-04 22:42 UTC (permalink / raw)
  To: netfilter; +Cc: netfilter

On Wednesday 2011-05-04 23:16, netfilter@buglecreek.com wrote:

>I have seen these rules used to detect a port scan:
>
>iptables -A INPUT -i $INTERFACE --proto tcp --tcp-flags SYN,ACK,FIN,RST
>RST -j LOG --log-prefix "PORT SCAN: " --log-level 6
>iptables -A INPUT -i $INTERFACE --proto tcp --tcp-flags SYN,ACK,FIN,RST
>RST -j DROP
>
>It seems to me that this is a legitimate TCP flag combination, unless
>I'm reading the rule wrong.


Bloggers using --tcp-flags to purportedly detect port scans are wasting 
their time. They could have just used -m conntrack --ctstate INVALID 
which should catch bogus flag combinations already.

Secondly, some scan types can use completely RFC-compliant traffic and 
therefore need a more sophisticated approach (cf. "Detecting 
and deceiving network scans" PDF).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-04 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 21:16 Port Scan Detection netfilter
2011-05-04 22:42 ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox