Bug 1452554 (CVE-2017-9047) - CVE-2017-9047 libxml2: Buffer overflow in function xmlSnprintfElementContent
Summary: CVE-2017-9047 libxml2: Buffer overflow in function xmlSnprintfElementContent
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2017-9047
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1452550 1452551 1548944 1695415
Blocks: 1452558
TreeView+ depends on / blocked
 
Reported: 2017-05-19 08:00 UTC by Andrej Nemec
Modified: 2023-09-26 13:23 UTC (History)
21 users (show)

Fixed In Version: libxml2 2.9.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-26 05:10:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Andrej Nemec 2017-05-19 08:00:09 UTC
A buffer overflow was discovered in libxml2. The function xmlSnprintfElementContent in valid.c is supposed to recursively dump the element content definition into a char buffer 'buf' of size 'size'. The variable len is assigned strlen(buf). If the content->type is XML_ELEMENT_CONTENT_ELEMENT, then (i) the content->prefix is appended to buf (if it actually fits) whereupon (ii) content->name is written to the buffer. However, the check for whether the content->name actually fits also uses 'len' rather than the updated buffer length strlen(buf). This allows us to write about "size" many bytes beyond the allocated memory. This vulnerability causes programs that use libxml2 to crash.

References:

http://seclists.org/oss-sec/2017/q2/258

Comment 1 Andrej Nemec 2017-05-19 08:05:10 UTC
Created libxml2 tracking bugs for this issue:

Affects: fedora-all [bug 1452550]

Comment 2 Andrej Nemec 2017-05-19 08:05:21 UTC
Created mingw-libxml2 tracking bugs for this issue:

Affects: fedora-all [bug 1452551]

Comment 4 Doran Moppert 2018-02-26 04:54:12 UTC
Statement:

This vulnerability exists in the DTD validation functionality of libxml2.  Applications that do not attempt to validate untrusted documents are not impacted.

Comment 8 Doran Moppert 2019-04-03 03:04:59 UTC
Upstream patch:

https://gitlab.gnome.org/GNOME/libxml2/commit/932cc9896ab


Note You need to log in before you can comment on or make changes to this bug.