How to fix: SOAP/XML parser has external entities enabled (XXE)
XML parsers with DOCTYPE / external entity processing enabled allow attackers to read local files, hit SSRF endpoints, and exfiltrate via DTD.
Why it matters
XML External Entity (XXE) attacks can read arbitrary files from the server filesystem (/etc/passwd, .env files, application configs), trigger SSRF against internal networks, and in some parsers enable remote code execution via Java serialization gadgets.
XML parsers with DOCTYPE / external entity processing enabled allow attackers to read local files, hit SSRF endpoints, and exfiltrate via DTD.
How to fix it
- 1Disable DOCTYPE declarations and external entity processing in every XML parser
- 2Use a hardened DocumentBuilderFactory / SAXParserFactory with all external features off
- 3In Node.js, use fast-xml-parser with processEntities: false
Code examples
Java: hardened JAXP parser (no XXE)
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setXIncludeAware(false);
dbf.setExpandEntityReferences(false);Node.js fast-xml-parser: disable entity processing
import { XMLParser } from 'fast-xml-parser';
const parser = new XMLParser({
processEntities: false,
htmlEntities: false,
});
const result = parser.parse(xmlBody);References
Detected automatically by VulnRadar. The check id is api-soap-xxe-enabled, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is SOAP/XML parser has external entities enabled (XXE)?
- VulnRadar rates this critical severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id api-soap-xxe-enabled, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does SOAP/XML parser has external entities enabled (XXE) map to?
- It maps to CWE-611. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.