CVE-2018-1311
📋 TL;DR
CVE-2018-1311 is a use-after-free vulnerability in Apache Xerces-C XML parser versions 3.0.0 to 3.2.3 that can be triggered when processing external DTDs. This flaw could allow attackers to execute arbitrary code or cause denial of service on systems using vulnerable versions of the library. Any application or service that uses Xerces-C for XML parsing with DTD processing enabled is potentially affected.
💻 Affected Systems
- Apache Xerces-C
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise, data theft, or persistent backdoor installation.
Likely Case
Application crash or denial of service affecting XML processing functionality.
If Mitigated
No impact if DTD processing is disabled or if the vulnerability is not triggered.
🎯 Exploit Status
Exploitation requires crafting malicious XML with external DTD references. The vulnerability is in the library itself, not in specific applications.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: None - vulnerability not fixed in maintained version
Vendor Advisory: https://lists.apache.org/thread.html/r48ea463fde218b1e4cc1a1d05770a0cea34de0600b4355315a49226b%40%3Cc-dev.xerces.apache.org%3E
Restart Required: Yes
Instructions:
1. Upgrade to a different XML parsing library if possible
2. If continuing with Xerces-C, implement workarounds to disable DTD processing
3. Rebuild and redeploy affected applications after changes
🔧 Temporary Workarounds
Disable DTD Processing via DOM
allConfigure XML parser to disable DTD processing using standard parser features
Set parser feature: setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true)
Set parser feature: setFeature(XMLUni::fgXercesLoadExternalDTD, false)
Disable DTD Processing via Environment Variable
linuxSet XERCES_DISABLE_DTD environment variable to disable DTD processing in SAX parsers
export XERCES_DISABLE_DTD=1
🧯 If You Can't Patch
- Disable DTD processing in all XML parsers using the library
- Implement network segmentation to isolate systems using vulnerable Xerces-C versions
- Deploy WAF rules to block XML payloads with external DTD references
🔍 How to Verify
Check if Vulnerable:
Check application dependencies for Xerces-C version 3.0.0 to 3.2.3 using package managers or by examining linked libraries.
Check Version:
ldd <application> | grep xerces-c or check package manager: rpm -qa | grep xerces-c or dpkg -l | grep xerces-c
Verify Fix Applied:
Verify DTD processing is disabled by testing with XML containing external DTD references and confirming they are rejected.
📡 Detection & Monitoring
Log Indicators:
- Application crashes during XML parsing
- Error messages related to DTD processing failures
- Memory access violation errors
Network Indicators:
- XML payloads containing external DTD references
- Unusual requests to DTD URLs from XML parsers
SIEM Query:
source="application_logs" AND ("xerces" OR "XML parser") AND ("crash" OR "segmentation fault" OR "access violation")
🔗 References
- http://www.openwall.com/lists/oss-security/2024/02/16/1
- https://access.redhat.com/errata/RHSA-2020:0702
- https://access.redhat.com/errata/RHSA-2020:0704
- https://lists.apache.org/thread.html/r48ea463fde218b1e4cc1a1d05770a0cea34de0600b4355315a49226b%40%3Cc-dev.xerces.apache.org%3E
- https://lists.apache.org/thread.html/r90ec105571622a7dc3a43b846c12732d2e563561dfb2f72941625f35%40%3Cc-users.xerces.apache.org%3E
- https://lists.apache.org/thread.html/rabbcc0249de1dda70cda96fd9bcff78217be7a57d96e7dcc8cd96646%40%3Cc-users.xerces.apache.org%3E
- https://lists.apache.org/thread.html/rfeb8abe36bcca91eb603deef49fbbe46870918830a66328a780b8625%40%3Cc-users.xerces.apache.org%3E
- https://lists.debian.org/debian-lts-announce/2020/12/msg00025.html
- https://lists.debian.org/debian-lts-announce/2023/12/msg00027.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7A6WWL4SWKAVYK6VK5YN7KZP4MZWC7IY/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AJYZUBGPVWJ7LEHRCMB5XVADQBNGURXD/
- https://marc.info/?l=xerces-c-users&m=157653840106914&w=2
- https://www.debian.org/security/2020/dsa-4814
- https://www.oracle.com/security-alerts/cpujan2022.html
- http://www.openwall.com/lists/oss-security/2024/02/16/1
- https://access.redhat.com/errata/RHSA-2020:0702
- https://access.redhat.com/errata/RHSA-2020:0704
- https://lists.apache.org/thread.html/r48ea463fde218b1e4cc1a1d05770a0cea34de0600b4355315a49226b%40%3Cc-dev.xerces.apache.org%3E
- https://lists.apache.org/thread.html/r90ec105571622a7dc3a43b846c12732d2e563561dfb2f72941625f35%40%3Cc-users.xerces.apache.org%3E
- https://lists.apache.org/thread.html/rabbcc0249de1dda70cda96fd9bcff78217be7a57d96e7dcc8cd96646%40%3Cc-users.xerces.apache.org%3E
- https://lists.apache.org/thread.html/rfeb8abe36bcca91eb603deef49fbbe46870918830a66328a780b8625%40%3Cc-users.xerces.apache.org%3E
- https://lists.debian.org/debian-lts-announce/2020/12/msg00025.html
- https://lists.debian.org/debian-lts-announce/2023/12/msg00027.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7A6WWL4SWKAVYK6VK5YN7KZP4MZWC7IY/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AJYZUBGPVWJ7LEHRCMB5XVADQBNGURXD/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/AJYZUBGPVWJ7LEHRCMB5XVADQBNGURXD/
- https://marc.info/?l=xerces-c-users&m=157653840106914&w=2
- https://www.debian.org/security/2020/dsa-4814
- https://www.oracle.com/security-alerts/cpujan2022.html