Dumping the content of a table, without Sql injection
An API endpoint returned a verbose database error when a required field was set to null, exposing the database type, table name, and column structure including sensitive fields. By brute-forcing company names, the attacker could retrieve all rows from the customer portal credentials table.
Published on medium.com
A bit about the target. All the requests were going in json.
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 application did not handle database errors gracefully and returned the raw database error message to the client, which included schema details and data.
Impact
The attacker could obtain sensitive data such as company IDs, invite codes, and password hashes, potentially leading to account takeover.
What the attacker needed
Access to the API endpoint; knowledge of company names
The fix
The application should catch database exceptions and return generic error messages to clients, and should validate input to prevent null values from reaching the database.
How it was found
- Send a POST request to /api/customers/invitation with a JSON body containing a company name and a null email.
- Observe the error response that reveals database details.
- Collect company names via OSINT and recon.
- Brute-force the company parameter with the collected names to retrieve rows from the customer_portal_credentials table.
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.
When a web application sends a request with missing or invalid data, it should respond with a simple error message. Here, the server instead showed a detailed database error that revealed the names of tables and columns, and even parts of the data. An attacker can use this information to learn about the database and then try to extract more data by guessing company names.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.