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 (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 (What is a Blind XXE Attack?, 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 (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” (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 (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 (Spilling Local Files via XXE, 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 (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 (Dead-End XXE to AWS Credential Theft, 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 (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 (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 (Blind XXE to Root-Level File Read).

Sources