Bug 485461 (CVE-2009-0362)

Summary: CVE-2009-0362 fail2ban: remote DoS via crafted domain names
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: axel.thimm, vogel
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://nvd.nist.gov/nvd.cfm?cvename=CVE-2009-0362
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-18 15:54:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 485464, 485465, 485466    
Bug Blocks:    
Attachments:
Description Flags
patch to fix the issue taken from Debian BTS none

Description Vincent Danen 2009-02-13 17:15:21 UTC
Name: CVE-2009-0362
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0362
Assigned: 20090129
Reference: CONFIRM: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514163
Reference: BID:33734
Reference: URL: http://www.securityfocus.com/bid/33734
Reference: SECUNIA:33890
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.

Comment 2 Vincent Danen 2009-02-13 17:20:45 UTC
Created attachment 331847 [details]
patch to fix the issue taken from Debian BTS

Comment 3 Vincent Danen 2009-02-13 17:38:34 UTC
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[679]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=26.232.125.75.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 26.232.125.75.  This is regardless of any filter.d/ configuration file.

Comment 4 Robert Vogelgesang 2009-02-16 14:18:36 UTC
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.