Skip to contentSkip to conversation

ICMP floods

DISCUSSION Edmund Turner 4 participants 7 messages Oct 15, 2003 – Oct 16, 2003

lore
Share & tools
lore
#0 lore raw

Hey everyone!
Im tyring to create a proper ICMP chain that will blocked ICMP flooding by Viruses and DOS attacks. Would the ruleset below be sufficient? I cant simulate the exact ICMP flooding, so im only assuming that limiting the ICMP burst to 10 /sec and limiting it to 5/sec.

Any input is appreciated!!

#####################
#####ICMP CHAINS#####
#####################
/sbin/iptables -N ICMP
/sbin/iptables -F ICMP
/sbin/iptables -A ICMP -m limit -p ICMP -i eth2 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth1 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth0 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -p icmp --icmp-type echo-reply -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT
/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT #/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit --limit 5/second -j ACCEPT
/sbin/iptables -A ICMP -p icmp -j LOG --log-level 5 --log-prefix "ICMP
DROP: "
/sbin/iptables -A ICMP -p icmp -j DROP

regards
edmund

#1 lore raw
Quoted 19 lines · Edmund Turner

Hey everyone!
Im tyring to create a proper ICMP chain that will blocked ICMP flooding by Viruses and DOS attacks. Would the ruleset below be sufficient? I cant simulate the exact ICMP flooding, so im only assuming that limiting the ICMP burst to 10 /sec and limiting it to 5/sec.

Any input is appreciated!!

#####################
#####ICMP CHAINS#####
#####################
/sbin/iptables -N ICMP
/sbin/iptables -F ICMP
/sbin/iptables -A ICMP -m limit -p ICMP -i eth2 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth1 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth0 --limit 1 --limit-burst 10

Quoted 8 lines

/sbin/iptables -A ICMP -p icmp --icmp-type echo-reply -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT
/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT #/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit --limit 5/second -j ACCEPT

The limit rule above will never be used as the packets are allready accepted by the rule above it.

Quoted 7 lines

/sbin/iptables -A ICMP -p icmp -j LOG --log-level 5 --log-prefix "ICMP
DROP: "
/sbin/iptables -A ICMP -p icmp -j DROP

regards
edmund

Signature · 6 lines
	Alistair Tonner
	nerdnet.ca
	Senior Systems Analyst - RSS
	
     Any sufficiently advanced technology will have the appearance of magic.
	Lets get magical!
#2 lore raw

Alistair Tonner wrote:
<Snip>

Quoted 3 lines
Quoted 3 lines

/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT #/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT

^

Quoted 5 lines
Quoted 2 lines

/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit --limit 5/second -j ACCEPT

The limit rule above will never be used as the packets are allready accepted by the rule above it.

<Snip>

It's commented out isn't it?

Cheers,
Michael

#3 lore raw

Yes it is commented out. Ive added a limit to both echo-request and echo-replies. Hope this would stop problems exhibit by the Welchia Virus.

Regards
edmund

#####################
#####ICMP CHAINS#####
#####################
/sbin/iptables -N ICMP
/sbin/iptables -F ICMP
/sbin/iptables -A ICMP -m limit -p ICMP -i eth2 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth1 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -m limit -p ICMP -i eth0 --limit 1 --limit-burst 10
/sbin/iptables -A ICMP -p icmp --icmp-type echo-reply -m limit --limit 5/second -j ACCEPT
/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit --limit 5/second -j ACCEPT
#/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type destination-unreachable -j ACCEPT
/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT /sbin/iptables -A ICMP -p icmp -j LOG --log-level 5 --log-prefix "ICMP
DROP: "
/sbin/iptables -A ICMP -p icmp -j DROP

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Michael Kearey
Sent: Wednesday, October 15, 2003 3:19 PM
Cc: [email protected]
Subject: Re: ICMP floods

Alistair Tonner wrote:
<Snip>

Quoted 3 lines
Quoted 3 lines

/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT #/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT

^

Quoted 1 line
Quoted 1 line

/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit

--limit

Quoted 4 lines
Quoted 1 line

5/second -j ACCEPT

The limit rule above will never be used as the packets are allready

accepted

Quoted 1 line

by the rule above it.

<Snip>

It's commented out isn't it?

Cheers,
Michael

#4 lore raw
In reply to Michael Kearey
Quoted 12 lines · Michael Kearey

Alistair Tonner wrote:
<Snip>

Quoted 3 lines
Quoted 3 lines

/sbin/iptables -A ICMP -p icmp --icmp-type source-quench -j ACCEPT /sbin/iptables -A ICMP -p icmp --icmp-type time-exceeded -j ACCEPT #/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -j ACCEPT

   ^
Quoted 3 lines
Quoted 2 lines

/sbin/iptables -A ICMP -p icmp --icmp-type echo-request -m limit --limit 5/second -j ACCEPT

Quoted 6 lines
Quoted 2 lines

The limit rule above will never be used as the packets are allready accepted by the rule above it.

<Snip>

It's commented out isn't it?

Okay ... perhaps I should go back to sleep now... *grin*

Quoted 3 lines

Cheers,
Michael

Signature · 6 lines
	Alistair Tonner
	nerdnet.ca
	Senior Systems Analyst - RSS
	
     Any sufficiently advanced technology will have the appearance of magic.
	Lets get magical!
#5 lore raw
In reply to Edmund Turner
Quoted 6 lines · Edmund Turner

Im tyring to create a proper ICMP chain that will blocked ICMP flooding by Viruses and DOS attacks. Would the ruleset below be sufficient? -- snip --
/sbin/iptables -A ICMP -m limit -p ICMP -i eth2 --limit 1 --limit-burst 10 /sbin/iptables -A ICMP -m limit -p ICMP -i eth1 --limit 1 --limit-burst 10 /sbin/iptables -A ICMP -m limit -p ICMP -i eth0 --limit 1 --limit-burst 10

You need "-j SOMETHING" -- the limit module would bypass the -j action if it happened too often. The man page doesn't say the default unit for
--limit (but it says the default is 3/hour which is kind of infrequent); I
would put in an explicit unit. Also I doubt you really need separate rate limiting on each interface. I see you have ACCEPT rules for every different type of ICMP packet. Here's a real simple rule which does almost the same thing:

iptables -t filter -A FORWARD -p ICMP -m limit --limit 2/second \
--limit-burst 10 -j ACCEPT
iptables -t filter -A FORWARD -p ICMP -m limit --limit 4/minute -j LOG iptables -t filter -A FORWARD -P ICMP -j DROP

(Or you could put this in a separate chain like your example: probably just as efficient if not more so, and more readable.)

Hope this helps!

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)

#6 lore raw

Jim, Thanks for the tip!. I just noticed that I missed the 'J'. Ive rewritten the rules as you advised.

Regards
edmund

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jim Carter
Sent: Thursday, October 16, 2003 12:36 AM
To: Edmund Turner
Cc: [email protected]
Subject: Re: ICMP floods

Quoted 1 line · Edmund Turner

Im tyring to create a proper ICMP chain that will blocked ICMP

flooding

Quoted 3 lines

by Viruses and DOS attacks. Would the ruleset below be sufficient? -- snip --
/sbin/iptables -A ICMP -m limit -p ICMP -i eth2 --limit 1

--limit-burst 10

Quoted 1 line

/sbin/iptables -A ICMP -m limit -p ICMP -i eth1 --limit 1

--limit-burst 10

Quoted 1 line

/sbin/iptables -A ICMP -m limit -p ICMP -i eth0 --limit 1

--limit-burst 10

You need "-j SOMETHING" -- the limit module would bypass the -j action if
it happened too often. The man page doesn't say the default unit for
--limit (but it says the default is 3/hour which is kind of
infrequent); I
would put in an explicit unit. Also I doubt you really need separate rate
limiting on each interface. I see you have ACCEPT rules for every different type of ICMP packet. Here's a real simple rule which does almost the same thing:

iptables -t filter -A FORWARD -p ICMP -m limit --limit 2/second \
--limit-burst 10 -j ACCEPT
iptables -t filter -A FORWARD -p ICMP -m limit --limit 4/minute -j LOG iptables -t filter -A FORWARD -P ICMP -j DROP

(Or you could put this in a separate chain like your example: probably just
as efficient if not more so, and more readable.)

Hope this helps!

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for
PGP key)