# Error-Based XXE
> Exfiltrating file contents through XML parser *error messages* — a channel that works when the application reflects nothing and all outbound egress is blocked.
## How it works
When a parser fails to open a resource, many implementations embed the **failed URI verbatim** in the exception text. If you can make a file's own contents become part of a URI the parser tries and fails to open, and the application surfaces parser errors in its response, the error message *is* the exfiltration channel — no reflection, no out-of-band infrastructure, no DNS size limits ([[raw/ultrared.ai/how-a-dead-end-xxe-turned-into-aws-credential-theft-13389|Dead-End XXE to AWS Credential Theft]]).
The mechanism uses parameter entities to: read the target file into `%file;`, then dynamically declare an entity that references a non-existent path containing `%file;`. The failed load throws an error carrying the path — i.e. the file ([[raw/portswigger.net/what-is-a-blind-xxe-attack-portswigger-2825|What is a Blind XXE Attack?]], [[raw/masterck.medium.com/out-of-band-xxe-attack-with-sensitive-data-exfiltration-3133|OOB XXE with Sensitive Data Exfiltration]]). Because the chaining needs nested parameter-entity references, it must be hosted in an **external DTD** — the internal subset forbids it ([[raw/instatunnel.my/blind-xxe-exfiltrating-data-out-of-band-in-2025-2821|Blind XXE in 2025]]).
A typical leaked error looks like `java.io.FileNotFoundException: /nonexistent/root:x:0:0:root:/root:/bin/bash...`.
## When to reach for it
- **Application returns parse errors** — SOAP faults echo detail; JDOM/Spring-over-Xerces Java apps surface exception strings "surprisingly often" ([[raw/ultrared.ai/how-a-dead-end-xxe-turned-into-aws-credential-theft-13389|Dead-End XXE]]).
- **In-band read aborts** on XML metacharacters (`<`, `&`, newlines) — the error channel sidesteps the "contents must be valid XML" limit of general-entity reflection ([[raw/dedsecops.com/xxe-as-a-dast-finding-in-band-error-based-and-out-of-band-confirmation-14210|XXE as a DAST Finding]]).
- **Egress blocked** — unlike OOB, this needs no outbound reachability at all.
## Local-DTD technique (no attacker server)
When outbound connections are blocked *and* you can't host an external DTD, abuse a DTD **already present on the server's disk**. Load the local DTD, then redefine one of its internal parameter entities to inject your error-based chain — the XML spec permits an internal subset to override a parameter entity declared in an external one ([[raw/noob.ninja/spilling-local-files-via-xxe-when-http-oob-fails-458|Spilling Local Files via XXE]], [[raw/instatunnel.my/blind-xxe-exfiltrating-data-out-of-band-in-2025-2821|Blind XXE in 2025]]). Common targets include `/usr/share/yelp/dtd/docbookx.dtd` on Linux desktop stacks; GoSecure's `dtd-finder` and h3xStream's list automate discovery. dedsecops measured the local-DTD read working against libxml2 2.9.14 using a DTD placed on local disk as a stand-in ([[raw/dedsecops.com/xxe-as-a-dast-finding-in-band-error-based-and-out-of-band-confirmation-14210|XXE as a DAST Finding]]).
## Escalation
The error channel scales to arbitrary-size reads (data rides the HTTP response, not a 253-char DNS label). Pointing the failing load at a **directory** rather than a file makes Java/Xerces leak a **directory listing** in the error — mapping all readable config files, then individual secrets, then IAM instance-role credentials from the metadata service ([[raw/ultrared.ai/how-a-dead-end-xxe-turned-into-aws-credential-theft-13389|Dead-End XXE to AWS Credential Theft]], [[raw/honoki.net/from-blind-xxe-to-root-level-file-read-access-honoki-461|Blind XXE to Root-Level File Read]]).
## Notable cases
- **Java SAML SSO consumer (ULTRA RED)** — DNS/HTTP egress blocked and no reflection; the Xerces exception string (`SAML exception: Error creating JDOM document...`) leaked `/etc/passwd`, a config-directory listing with DB creds and an Okta certificate, and finally live AWS instance-role credentials — zero OOB infra ([[raw/ultrared.ai/how-a-dead-end-xxe-turned-into-aws-credential-theft-13389|Dead-End XXE to AWS Credential Theft]]).
- **Akamai CloudTest (CVE-2025-49493)** — XBOW got the `system-id` leak (`[1,25,"file:/proc/self/environ"]`) from a SOAP 500, then combined external-DTD hosting with error-based extraction after CDATA and plain in-band approaches failed ([[raw/xbow.com/cve-2025-49493-xxe-in-akamai-cloudtest-3144|Akamai CloudTest]]).
- **Honoki private program** — verbose SAX errors (`...markup declarations...must be well-formed`) confirmed file existence and parser identity, then escalated to read-as-root ([[raw/honoki.net/from-blind-xxe-to-root-level-file-read-access-honoki-461|Blind XXE to Root-Level File Read]]).
## Related
- [[XML External Entity Injection]]
- [[Blind XXE]]
- [[XXE to SSRF and Cloud Metadata]]
- [[XXE Parser Defaults and Hardening]]
## Sources
- [[raw/ultrared.ai/how-a-dead-end-xxe-turned-into-aws-credential-theft-13389|How a Dead-End XXE Turned into AWS Credential Theft]]
- [[raw/portswigger.net/what-is-a-blind-xxe-attack-portswigger-2825|What is a Blind XXE Attack? | PortSwigger]]
- [[raw/xbow.com/cve-2025-49493-xxe-in-akamai-cloudtest-3144|CVE-2025-49493: XXE in Akamai CloudTest]]
- [[raw/honoki.net/from-blind-xxe-to-root-level-file-read-access-honoki-461|From Blind XXE to Root-Level File Read]]
- [[raw/noob.ninja/spilling-local-files-via-xxe-when-http-oob-fails-458|Spilling Local Files via XXE When HTTP OOB Fails]]
- [[raw/instatunnel.my/blind-xxe-exfiltrating-data-out-of-band-in-2025-2821|Blind XXE: Exfiltrating Data OOB in 2025]]
- [[raw/masterck.medium.com/out-of-band-xxe-attack-with-sensitive-data-exfiltration-3133|OOB XXE with Sensitive Data Exfiltration]]
- [[raw/dedsecops.com/xxe-as-a-dast-finding-in-band-error-based-and-out-of-band-confirmation-14210|XXE as a DAST Finding]]