Red Hat Bugzilla – Bug 485461
CVE-2009-0362 fail2ban: remote DoS via crafted domain names
Last modified: 2009-02-18 10:54:04 EST
Reference: CONFIRM: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514163
Reference: URL: http://www.securityfocus.com/bid/33734
Reference: URL: http://secunia.com/advisories/33890
filter.d/wuftpd.conf in Fail2ban 0.8.3 uses an incorrect regular
expression that allows remote attackers to cause a denial of service
(forced authentication failures) via a crafted reverse-resolved DNS
name (rhost) entry that contains a substring that is interpreted as an
IP address, a different vulnerability than CVE-2007-4321.
Created attachment 331847 [details]
patch to fix the issue taken from Debian BTS
The CVE description is a bit wrong as the problem isn't so much with the wuftpd.conf filter (which we would not care about since we don't ship it), but with the filtering code as can be seen in the patch.
A quick test from the Debian BTS:
fail2ban-regex "Feb 4 14:55:01 washoe CRON: (pam_unix) authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=22.214.171.124.gs.dynamic.163data.com.cn" "\s+\(pam_unix\)\s+authentication failure.* rhost=<HOST>$"
Patched, this will return "unable to find a corresponding IP address", unpatched it will return the IP 126.96.36.199. This is regardless of any filter.d/ configuration file.
The patch 0001-BF-anchoring-regex-for-IP-with-at-the-end.patch disables matching of strings containing IP addresses that are not space separated (see one of the test cases provided with the fail2ban source).
I've sent an email to the author of fail2ban, Cyril Jaquier, on 05-Feb-2009 regarding a different improvement to the regex in IP_CRE, where I suggested to add an <IPADDRESS> tag that would match only IP addresses. I also mentioned the problem of faked DNS replies in this email to Cyril. Until now, I received no reply. If I cannot get to a solution with Cyril in reasonable time, I'll open a new bug for fedora. Until then, I'll watch this bug here.