Bug 1051717 (CVE-2014-0591)

Summary: CVE-2014-0591 bind: named crash when handling malformed NSEC3-signed zones
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: carnil, codonell, ddu, hayato.suzuki, jkurik, j.orti.alcaine, jrusnack, myamazak, pfrields, psimerda, security-response-team, spoyarek, thozza, tkubota, vonsch, ykinoshi
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=moderate,public=20140113,reported=20140110,source=upstream,cvss2=2.6/AV:N/AC:H/Au:N/C:N/I:N/A:P,rhel-5/bind=notaffected,rhel-5/bind97=affected,rhel-6/bind=affected,rhel-7/bind=notaffected,fedora-all/bind=affected,cwe=CWE-227
Fixed In Version: bind 9.6-esv-r10-p2, bind 9.8.6-p2, bind 9.9.4-p2 Doc Type: Bug Fix
Doc Text:
A denial of service flaw was found in the way BIND handled queries for NSEC3-signed zones. A remote attacker could use this flaw against an authoritative name server that served NCES3-signed zones by sending a specially crafted query, which, when processed, would cause named to crash.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-17 23:02:09 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 1052010, 1052011, 1052708, 1052766, 1079892    
Bug Blocks: 1051720, 1063682    
Attachments:
Description Flags
bind 9.8.6 patch
none
bind 9.9.4 patch none

Description Vincent Danen 2014-01-10 20:56:54 EST
It was reported that a defect in how BIND handled queries for NSEC3-signed
zones could cause a crash of the named daemon with an "INSIST" failure when
processing queries that possessed certain properties.

A remote attacker could exploit this defect by constructing a
carefully-crafted query against an authoritative nameserver that served
NSEC3-signed zones.

Note that this flaw affects BIND versions 9.6.0 and higher (NSEC3 was
introduced in BIND 9.6.0 but is not automatically enabled).  Authoritative
nameservers that are serving at least one NSEC3-signed zone are vulnerable.
Authoritative nameservers that are NOT serving at least one NSEC3-signed
zone are not vulnerable, nor are recursive-only servers.  Servers running
versions of BIND older than 9.6.0 are also not vulnerable.

There are no workarounds for this issue.
Comment 3 Vincent Danen 2014-01-11 12:17:32 EST
Created attachment 848662 [details]
bind 9.8.6 patch

This is a diff of 9.8.6-P1 vs 9.8.6-P2 which includes the fix.  It also includes one unrelated fix as well:

3693.  [security]      memcpy was incorrectly called with overlapping
                       ranges resulting in malformed names being generated
                       on some platforms.  This could cause INSIST failures
                       when serving NSEC3 signed zones.  [RT #35120]

3658.  [port]          linux: Address platform specific compilation issue
                       when libcap-devel is installed. [RT #34838]
Comment 4 Vincent Danen 2014-01-11 12:18:25 EST
Created attachment 848664 [details]
bind 9.9.4 patch

This is a diff of 9.9.4-P1 vs 9.9.4-P2 which includes the fix.  It also includes one unrelated fix as well:

3693.  [security]      memcpy was incorrectly called with overlapping
                       ranges resulting in malformed names being generated
                       on some platforms.  This could cause INSIST failures
                       when serving NSEC3 signed zones.  [RT #35120]

3658.  [port]          linux: Address platform specific compilation issue
                       when libcap-devel is installed. [RT #34838]
Comment 10 Vincent Danen 2014-01-13 17:08:18 EST
The second reference below has a FAQ, one of which is the question of what caused the flaw.  The answer is:

"The bug (which causes an INSIST crash in name.c) is caused by a misuse of the standard memcpy() function which is, by happenstance, safe on most platforms: in this case a memory buffer was being copied to an overlapping buffer.  The bug went undetected until recently because most implementations of memcpy() do handle this situation safely, but the standard does not require them to do so.  Recent optimizations to glibc have removed the safetly net, exposing a long-existing but previously harmless coding error in named."

This is related to newer implementations of glibc's memcpy() function.


External References:

https://kb.isc.org/article/AA-01078/0
https://kb.isc.org/article/AA-01085
Comment 11 Vincent Danen 2014-01-13 17:09:50 EST
Created bind tracking bugs for this issue:

Affects: fedora-all [bug 1052708]
Comment 22 Fedora Update System 2014-01-17 23:21:29 EST
bind-9.9.3-14.P2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 23 Fedora Update System 2014-01-17 23:24:28 EST
bind-9.9.4-11.P2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 24 errata-xmlrpc 2014-01-20 12:33:13 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2014:0043 https://rhn.redhat.com/errata/RHSA-2014-0043.html
Comment 25 Huzaifa S. Sidhpurwala 2014-01-24 00:43:40 EST
As discussed in comment #10, this flaws would affect bind only if used with glibc versions which have newer implementation of the memcpy() function.

Therefore it does not directly affect the version of bind97 shipped in Red Hat Enterprise Linux 5. Nevertheless, to protect against this flaw appearing in future builds of bind97 (possibly done with different compiler or C library optimization), Red Hat Security Response Team has decided to address this issue.  There is no plan for an immediate update correcting this issue, it will be corrected with future bind97 packages updates.
Comment 26 Huzaifa S. Sidhpurwala 2014-01-24 00:45:03 EST
Statement:

This issue does not affect the version of bind and bind97 as shipped with Red Hat Enterprise Linux 5. For a technical explanation please see https://bugzilla.redhat.com/show_bug.cgi?id=1051717#c25
Comment 28 Huzaifa S. Sidhpurwala 2014-01-30 00:19:51 EST
Note:

The following references pertain to "memcpy() optimizations" mentioned in the previous comments on this bug:

https://sourceware.org/bugzilla/show_bug.cgi?id=12518
http://article.gmane.org/gmane.comp.lib.glibc.alpha/15278
https://bugzilla.redhat.com/show_bug.cgi?id=638477
Comment 31 Martin Prpic 2014-08-26 07:34:35 EDT
IssueDescription:

A denial of service flaw was found in the way BIND handled queries for NSEC3-signed zones. A remote attacker could use this flaw against an authoritative name server that served NCES3-signed zones by sending a specially crafted query, which, when processed, would cause named to crash.
Comment 32 errata-xmlrpc 2014-09-16 01:29:33 EDT
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 5

Via RHSA-2014:1244 https://rhn.redhat.com/errata/RHSA-2014-1244.html