That time I broke into an API and became a billionaire
A configuration change to allow XML on an internal API accidentally enabled XML parsing on all endpoints, leading to an XXE vulnerability. The attacker exploited this to read files, decompile the API, and discover an undocumented endpoint that allowed transferring arbitrary amounts of money.
A few years back, I was working on an engagement for a customer who handles financial transactions and transfers. This included an internal API with a dependency on a third-party banking API.
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 a misconfiguration where enabling XML parsing for one endpoint inadvertently enabled it globally, and the XML parser was not secured against external entities.
Impact
An attacker could read arbitrary files from the server, obtain the API's source code, and potentially transfer any amount of money from any account to another without detection.
What the attacker needed
API accepts XML on endpoints; XML parser allows external entities; No authentication required for XXE
How it was found
- Send a request with Content-Type application/xml to an endpoint that normally accepts JSON.
- Include an XML external entity that references a local file, and observe the file contents in the response.
- Use the file:// protocol with a trailing slash to list directories and find the path to the API's JAR file.
- Use a PHP filter to base64-encode the JAR file and exfiltrate it through the XXE.
- Decompile the JAR file to source code and analyse it to find undocumented endpoints and business logic.
- Exploit the discovered endpoint to transfer a large amount of money to a test account.
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.
The API was set up to only accept JSON data, but a change to support XML for a new service accidentally made all endpoints accept XML. XML has a feature that can be abused to read files from the server, which let the attacker download the API's code and find a hidden money-transfer feature.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.