CVE-2016-4472: Buffer Overflow
It was found that original patch for issues CVE-2015-1283 and CVE-2015-2716 used overflow checks that could be optimized out by some compilers applying certain optimization settings, which can cause the vulnerability to remain even after applying the patch.
One pattern in the fix for CVE-2015-1283/CVE-2015-2716 is:
/ bufferSize is positive here / do { bufferSize = 2; } while (bufferSize < neededSize && bufferSize > 0); if (bufferSize <= 0) { errorCode = XMLERRORNOMEMORY; return NULL;
Any of the modern optimizing compiler, IF able to infer that bufferSize is initially positive (which is true but not obvious to see through local reasoning), will eliminate bufferSize > 0 as always true when the execution is defined, and bufferSize <= 0 as always false when the execution is defined.
Without knowing that bufferSize starts positive, an optimizing compiler could also move the test bufferSize > 0 out of the loop, that is, compile the code as if it had been written:
if (bufferSize <= 0) errorCode = XMLERRORNOMEMORY; return NULL; else { do { bufferSize = 2; } while (bufferSize < neededSize); }
Both cases leads to not eliminating the vulnerability.
Upstream patch:
https://sourceforge.net/p/expat/codegit/ci/f0bec73b018caa07d3e75ec8dd967f3785d71bde/tree/expat/lib/xmlparse.c?diff=a238d7ea7a715ef3850c4cbdd86aeda7077b6bbc
Other sources
The overflow protection in Expat is removed by compilers with certain optimization settings, which allows remote attackers to cause a denial of service (crash) or possibly execute arbitrary code via crafted XML data. NOTE: this vulnerability exists because of an incomplete fix for CVE-2015-1283 and CVE-2015-2716.
— MITRE
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is CVE-2016-4472?
CVE-2016-4472 refers to a vulnerability in Expat that allows remote attackers to cause a denial of service or possibly execute arbitrary code via crafted XML data.
What is the severity of CVE-2016-4472?
The severity of CVE-2016-4472 is rated as high with a CVSS score of 8.1.
How does CVE-2016-4472 affect Expat?
CVE-2016-4472 affects Expat by removing the overflow protection in certain optimization settings, making it susceptible to crashing or arbitrary code execution.
Which software versions are affected by CVE-2016-4472?
The affected software versions include xmlrpc-c 1.16.33-3.1ubuntu5.2, libxmltok 1.2-4ubuntu0.18.04.1~, libxmltok 1.2-4ubuntu0.20.04.1~, libxmltok 1.2-3ubuntu0.16.04.1~, libxmltok 1.2-4ubuntu0.22.04.1~, expat 2.2.6-2+deb10u4, expat 2.2.6-2+deb10u6, expat 2.2.10-2+deb11u5, expat 2.5.0-1, and expat 2.5.0-2.
Where can I find more information about CVE-2016-4472?
More information about CVE-2016-4472 can be found on the following references: [link1](https://access.redhat.com/security/cve/CVE-2015-1283), [link2](https://access.redhat.com/security/cve/CVE-2015-2716), [link3](https://sourceforge.net/p/expat/code_git/ci/f0bec73b018caa07d3e75ec8dd967f3785d71bde/tree/expat/lib/xmlparse.c?diff=a238d7ea7a715ef3850c4cbdd86aeda7077b6bbc).