Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 05 Jan 2012 22:22:21 +1100
From: David Hicks <>
Subject: Re: speaking of DoS, openssh and dropbear

iptables (/ip6tables) already allows for rate limiting via the hashlimit
match extension. The inbuilt support for source masks makes it easy to
progressively block larger subnets if an attacker has control over large
subnets with many available IP addresses.

Assume that or fd01:2345:6789::1 starts flooding your server
with 50 connection requests to SSH per second. iptables/ip6tables (via
the hashlimit extension) is configured to prevent more than 3 SSH
connection attempts per 15 minutes per IPv4 address (/32) or /64 IPv6
allocation. After the first 3 SYN packets from the attacker, all further
SYN packets will be dropped/recorded/whatever until >=15 minutes pass
without another SYN packet arriving. It may also be possible to reset
any existing connections the attacker has to the server and add the
attacker to a temporary blacklist that drops all their traffic.

You may also have another rule configured such that no more than 30 SSH
connection attempts are allowed per 15 minutes per /24 IPv4 allocation
or /48 IPv6 allocation. An attacker that controls or
fd01:2345:6789::0/48 (not the best example) would no longer be able to
utilise a compromised subnet to bypass the more stringent 3
connections/15 minutes rule.

It is worth noting that the man page for ip6tables appears to contain an
error[1] for the --hashlimit-srcmask argument. The manual indicates
values for the mask must range from 0 to 32 bits (correct for IPv4).
However values from 0 to 128 seem to be supported[2] if ip6tables is
being used.

OpenBSD's pf also allows for connection rate limiting with the
"max-src-conn-rate" restriction. I haven't investigated how this works
in comparison to iptables/hashlimit or whether it can support grouping
of addresses sharing a common mask.

The question these approaches raise is whether it is advisable to
reinvent rate limiting in each and every network daemon. Performing rate
limiting at the system/interface level prevents unwanted and expensive
context switches to each daemon. Configuration and maintenance is much
simpler because administrators don't need to learn 50 different ways to
configure rate limiting for each daemon. There is also less risk for
bugs to be written into the rate limiting implementation of each daemon.

On a technical note, rate limiting requires a small amount of memory
(buckets) to store information about recent connections. For this
reason, allowing IPv6 rate limiting granularity at the /128 level would
be inadvisable as an attacker with /64 addresses could quickly exhaust
the table capacity/available memory. The design of the data structures
and algorithms for the table need to be very efficient. Taking it down
another level, a table that is larger than available L1-L3 cache could
further degrade performance ([4] and [5] discuss hash tables and CPU


Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.