“Beyond the Obvious: How a Dead-End XXE Led to a Critical SQLi Goldmine”
An XML file upload endpoint was found to parse user-supplied XML and pass values into a SQL query without proper escaping. By using XML entities to bypass XML parsing, an attacker could inject SQL commands and potentially access nearly a million financial records.
infosecwriteups.com
Published on infosecwriteups.com
We’ve all been there. You find an endpoint that makes your hacker senses tingle.
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
Impact
An attacker could read sensitive financial data from a live corporate database containing nearly a million records, though the author stopped after confirming the count.
What the attacker needed
Access to the file upload endpoint; knowledge of the expected XML structure
How it was found
- Discover a file upload form that expects XML input.
- Craft a valid XML document with the expected structure (AccountingEntry with MainAccount, Credit, Debit, Invoice).
- Test for SQL injection by inserting an apostrophe, observe no error due to XML escaping.
- Use the XML entity ' to represent the apostrophe and trigger a database error.
- Confirm time-based SQL injection with a WAITFOR DELAY payload.
- Automate exploitation with sqlmap using the --tamper=htmlencode flag.
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 website accepted a file that looked like a form, but it actually read the file as structured data (XML) and used parts of it to look up information in a database. Because the site didn't properly separate the data from the commands it sent to the database, a attacker could sneak in extra database commands. This could let them read, change, or delete sensitive information.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.