Skip to main content
CriticalAPIOWASP A05:2021CWE-611

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

  1. 1Disable DOCTYPE declarations and external entity processing in every XML parser
  2. 2Use a hardened DocumentBuilderFactory / SAXParserFactory with all external features off
  3. 3In Node.js, use fast-xml-parser with processEntities: false

Code examples

Java: hardened JAXP parser (no XXE)

Java
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

JavaScript
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.

See every api check

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.

Propose a checkHow a check is built

Scan your own site for soap/xml parser has external entities enabled (xxe)

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

SOAP/XML parser has external entities enabled (XXE) | VulnRadar