CVE-2017-16931
Critical · 9.8CVSS
9.8
EPSS
4.6%
Published
Nov 23, 2017
CISA due date
—
Cloudanix analysis
A flaw in a widely used XML library lets attackers send specially crafted documents that can take over or crash affected software over the network.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Mishandling of parameter-entity references in DTD parsing via the NEXTL macro invoking xmlParserHandlePEReference on '%' characters, resulting in memory corruption.
Why it matters to the business
Attackers could remotely execute arbitrary code or crash XML-processing applications, leading to service outages, data exposure, or system compromise in any environment using the vulnerable library.
How an attack unfolds
An attacker supplies a crafted XML document containing a DTD with a '%' character in a parameter-entity reference; the parser mishandles it during entity resolution, corrupting memory and enabling code execution or denial of service.
How to fix it
Upgrade libxml2 to version 2.9.5 or later. Rebuild and redeploy all dependent applications after the library update. Disable external DTD resolution where feasible as a temporary mitigation.
How to confirm the fix worked
Verify installed libxml2 version is 2.9.5 or newer via package manager or xml2-config --version. Test parsing of sample DTD-containing XML documents to confirm no crash or corruption occurs.
Typical attack path
- Identify a target application that parses untrusted XML using the vulnerable libxml2 version
- Craft a malicious XML payload containing a DTD with parameter-entity reference using '%'
- Deliver the payload via network request, file upload, or document processing
- Trigger parsing to invoke the flawed NEXTL macro path
- Achieve memory corruption leading to RCE or crash
How to detect it
Review application logs for XML parsing errors or crashes around DTD processing; inspect inbound XML documents containing DTDs with parameter entities; correlate with process crashes or memory-related faults in libxml2-linked binaries.
What your security team should do
- Prioritize inventory of all systems using libxml2 and schedule immediate upgrades to 2.9.5+
- Apply network controls to restrict untrusted XML input until patches are deployed
- Monitor vulnerability scanners and dependency reports for remaining instances of versions before 2.9.5
- Review and harden XML parsing configurations to disable unnecessary entity expansion
The record
parser.c in libxml2 before 2.9.5 mishandles parameter-entity references because the NEXTL macro calls the xmlParserHandlePEReference function in the case of a '%' character in a DTD name.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.4 | libxml2 | 0 | 2.9.5-r0 |
| Alpine:v3.5 | libxml2 | 0 | 2.9.5-r0 |
| Alpine:v3.6 | libxml2 | 0 | 2.9.5-r0 |
| Debian:11 | libxml2 | 0 | 2.9.4+dfsg1-3.1 |
| Debian:12 | libxml2 | 0 | 2.9.4+dfsg1-3.1 |
| Debian:13 | libxml2 | 0 | 2.9.4+dfsg1-3.1 |
| Debian:14 | libxml2 | 0 | 2.9.4+dfsg1-3.1 |
| Debian:7 | libxml2 | 0 | 2.8.0+dfsg1-7+wheezy11 |
| Ubuntu:14.04:LTS | libxml2 | 0 | 2.9.1+dfsg1-3ubuntu4.10 |
| Ubuntu:16.04:LTS | libxml2 | 0 | 2.9.3+dfsg1-1ubuntu0.3 |
Related vulnerabilities
- CVE-2017-5969 libxml2 2.9.4, when used in recover mode, allows remote attackers to cause a denial of… Also affects libxml2
- CVE-2016-9318 libxml2 2.9.4 and earlier, as used in XMLSec 1.2.23 and earlier and other products, does… Also affects libxml2
- CVE-2016-5131 Use-after-free vulnerability in libxml2 through 2.9.4, as used in Google Chrome before… Also affects libxml2
- CVE-2025-9714 Uncontrolled recursion in XPath evaluation in libxml2 up to and including version 2.9.14… Also affects libxml2
- CVE-2025-8732 A vulnerability was found in libxml2 up to 2.14.5. Also affects libxml2
- CVE-2025-6170 A flaw was found in the interactive shell of the xmllint command-line tool, used for… Also affects libxml2
- CVE-2025-49796 A vulnerability was found in libxml2. Also affects libxml2
- CVE-2025-49795 A NULL pointer dereference vulnerability was found in libxml2 when processing XPath XML… Also affects libxml2