h1{Error based XXE - bug bounty writeup}
An XML parser on a public application had external entity processing enabled, allowing an attacker to read local files. The attacker used error-based techniques and a local DTD file to exfiltrate file contents without outbound HTTP requests.
During my usual recon, I’ve found something very interesting on the “ZOOOOOOOOM” application of XXX company.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the XML parser was configured to allow custom DOCTYPE declarations and external entities, which is insecure.
Impact
An attacker could read arbitrary files on the server, potentially leading to further compromise.
What the attacker needed
XML parser with external entities enabled; Ability to send XML requests; Outbound FTP allowed (for initial exfiltration)
The fix
The issue was fixed by the vendor.
How it was found
- Send an XML request with a DOCTYPE that defines an external entity pointing to a controlled domain.
- Observe that only a DNS request is made, indicating external entity processing is enabled but HTTP is blocked.
- Upload a malicious DTD file to a world-readable location on the target server.
- Send an XML request that references the uploaded DTD and attempts to exfiltrate a local file via FTP.
- Use the jar protocol to trigger an error that includes the file contents.
- Later, use a local DTD file to perform the attack without external interaction.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
XML is a data format that can include special instructions called entities. If a server processes these entities without restrictions, an attacker can make it read files from the server and send them elsewhere. This is called an XML External Entity (XXE) attack.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.