XXE to SSRF to Windows Administrator Hashes
The application was vulnerable to XML external entity injection in a POST request, allowing an attacker to read local files and make outbound connections. The attacker used this to exfiltrate sensitive Windows files, including one containing base64-encoded administrator credentials.
medium.com
Published on medium.com
On a recent Pen test I was tasked with testing a bespoke Windows application that connected to a REST API. The Application was used by sales team members to create quotes and manage clients.
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 external entities and DTDs, and the application accepted XML input without proper sanitisation.
Impact
An attacker could read arbitrary files on the server, potentially obtaining administrator credentials, and could make outbound connections to internal or external systems.
What the attacker needed
Ability to send XML requests to the API; attacker-controlled server for DTD hosting
How it was found
- Capture a POST request that updates customer details.
- Send the request to Burp Repeater and modify the XML body to include an external entity.
- Host a malicious DTD file on a VPS and reference it in the XML.
- Use the DTD to read local files such as C:/windows/win.ini and exfiltrate them via HTTP.
- Try reading other sensitive files like sysprep.inf and sysprep.xml.
- Decode the base64-encoded administrator credentials found in sysprep.xml.
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 external entity injection (XXE) is a flaw where an application accepts XML input that can include special instructions to fetch external resources. Here, the attacker could make the server read files on its own disk and send them to the attacker, and also make the server connect to other systems. This led to stealing administrator passwords stored in configuration files.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.