What is XML External Entity Injection (XXE)?
FAQs
An application processes an XML file provided by a hacker. The XML file references an external file (like system credentials). If poorly secured, the application could expose sensitive data like passwords.
Disable external entity processing in your XML parser settings. Using modern, secure libraries to handle XML also minimizes risks significantly.
They usually occur due to outdated XML processing tools or misconfigured settings in applications, leaving them open to malicious entity references.
Attackers could steal sensitive data, compromise system integrity, or even gain control of the affected application entirely.
Detection: XXE vulnerabilities are found through both manual penetration testing and automated scanning.
Dynamic Application Security Testing (DAST) tools send crafted XML payloads to application endpoints and check for out-of-band callbacks or direct response disclosure.
Static Application Security Testing (SAST) tools analyze source code for XML parser configurations that enable external entity processing.
Out-of-band XXE detection using DNS callbacks (via tools like Burp Collaborator or interactsh) catches cases where the application doesn't reflect data in responses — the attacker detects successful entity processing via DNS or HTTP callbacks to an external server they control.
Remediation: the fix is straightforward in principle — disable external entity processing in the XML parser. In practice, the fix depends on the language and library: in Java (JAXP), set `XMLConstants.FEATURESECUREPROCESSING` to true; in PHP, use `libxmldisableentityloader(true)` (deprecated in PHP 8.0 as the default changed); in Python (lxml), use `resolveentities=False`. Where XML isn't a business requirement, switching to JSON eliminates the vulnerability entirely — JSON has no equivalent of DTD/entity expansion.
For security teams building developer education programs, XXE is an excellent case study: it's a class of vulnerability that appears entirely due to a default-on, legacy XML feature that almost no modern application needs. Disabling it is a one-line configuration change with no functional cost.