GNOME Bugzilla – Bug 766414
CVE-2016-4483: out-of-bounds read parsing an XML in libxml2 using recover mode
Last modified: 2018-08-21 09:51:44 UTC
Gustavo Grieco reported the following on the oss-security mailinglist, where CVE-2016-4483 was assigned: Hi, We found an out-of-bounds read parsing a specially crafted xml in libxml2 if recover mode is used. It affects all versions. It was discovered before by another guy but for some reason, never reported or fixed. Since upstream is not responding, i think it is a good time to publish some details here. $ xmllint -recover ohizsmaase.xml.-6355798974422201279 ... ==2994== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60040000d5d3 at pc 0x73320a bp 0x7fffffffc1e0 sp 0x7fffffffc1d8 READ of size 1 at 0x60040000d5d3 thread T0 ... 0x60040000d5d3 is located 0 bytes to the right of 3-byte region [0x60040000d5d0,0x60040000d5d3) And backtrace is here: ...
+ Trace 236245
A reproducer is available upon request. Please assign a CVE if necesary. Regards, Gustavo.
Created attachment 327854 [details] reproducer
First that's not in parsing, that's in saving the XML back. Second the recover flag is not XML compliant and should never be used by default in an automated fashion. So it's not a critical issue, plus I don't have a patch yet, and a 15mn debug session didn't allow me to find yet the root of the issue. So this is not making the release of 2.9.4, Daniel
BTW creating CVE with factually incorrect statements don't make me very happy, I assume you understand why ! Daniel
Created attachment 328364 [details] [review] Patch for upstream This is a problem exposed when trying to save a misformed content that was forced to be generated by asking for the recover non conformant mode. The generated tree is correct, but the embedded string is not and we get that out of bound issue because the serializer assumed the content was correct as through result of normal parsing checks. Not a security issue, but a bug triggered by doing an explicitely dangerous and not recommended operation. Daniel
Fix committed to master in c97750d11bb8b6f3303e7131fe526a61ac65bcfd: <https://git.gnome.org/browse/libxml2/commit/?id=c97750d11bb8b6f3303e7131fe526a61ac65bcfd>
I'm making this bug public since it's been fixed for two years and hardly critical.