Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

One of the rules to prevent unexpected attack is to prevent SYN & FIN being used together.

SYN and FIN are both set

$IPT -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP

How do I use hping to test if this iptable rule works? hping3 --keep -S -F??? Is this complete?

When just type iptables -L, it shows:

Chain INPUT (policy DROP) target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP tcp -- anywhere anywhere tcp flags:FIN,SYN/FIN,SYN

WHY do I need to put the "SYN,FIN" twice before drop? Is it because one for source and one for destination?

share|improve this question
It's not a prevention unless your TCP/IP stack is lousy; merely a detection (only if you check counters/logs). – poige Feb 4 '11 at 5:06
up vote 1 down vote accepted

I use nmap:

# nmap --scanflags SYN,FIN HOSTNAME
# iptables -nv -L
Chain INPUT (policy ACCEPT 866K packets, 457M bytes)
 pkts bytes target     prot opt in     out     source               destination         
  120  5280 DROP       tcp  --  *      *             tcp flags:0x03/0x03 
share|improve this answer
@snow -n options resolve flags to numeric(FIN=0x01,SYN=0x02 SYN+FIN=0x03) See… – alvosu Feb 4 '11 at 5:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.