Second Order XXE Exploitation
The application accepted XML data inside a SOAP request and stored it without blocking external entities, so an attacker could define an entity pointing to a local file. Because a second request returned the stored data, the attacker could read files and list directories on the server.
Published on kuldeep.io
This writeup is about my recent discovery on Synack Red Team which was a Second Order XXE that allowed me to read files stored on the web server.
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 used for the stored normal text did not disable external entity resolution, and the stored data was later returned to the user.
What the attacker needed
Access to the API; ability to send SOAP requests
How it was found
- Send the saveNormalText request with XML data containing an external entity that points to a local file.
- Send the GetNamedNormalText request to retrieve the saved data.
- Observe the contents of the local file in the response.
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 allows a document to define 'entities', which are like shortcuts that can point to other files. If a server processes these definitions without checking them, an attacker can make the server include the contents of a local file in the data it stores. Here, a second request that fetched the stored data revealed the file contents.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.