SQL Injection - JSON 'name' parameter
A SQL injection vulnerability was found in the JSON 'name' parameter of an API endpoint, allowing an attacker to manipulate backend SQL queries. This could lead to unauthorised data access, leakage, or full database compromise.
Originally disclosed on HackerOne
- Triaged in 33 hours
- Fixed in 9 days
- Disclosed after 6 months
Description:
Hi, team! I discovered a SQL Injection vulnerability in the formid parameter on the website █████████ . The vulnerability allows for the manipulation of SQL queries executed by the backend database, which could potentially lead to unauthorized data access or manipulation.
References
█████
Impact
The ability to manipulate SQL queries can lead to:
- Unauthorized access to sensitive data.
- Potential data leakage.
- Data manipulation or corruption.
- Full database compromise if administrative permissions are accessible.
System Host(s)
█████████
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
Use this command:
sqlmap -r sqlmap.txt --tamper=between --batch -p 'name' -dbms=Oracle --technique=T --dbs
████
The sqlmap.txt file:
███
The original request ('name' parameter is what is vulnerable):
POST /er2_mrrp/api/v3/hft/subtitle/ HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: ██████████
Cookie: ██████
Content-Type: application/json
Accept: */*
Content-Length: 46
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Host: ██████████
Connection: Keep-alive
{"filters":{"name":"Search-Pag-0-Search-Pag"}}
Suggested Mitigation/Remediation Actions
Use parameterized queries when dealing with SQL queries that contain user input. Parameterized queries allow the database to understand which parts of the SQL query should be considered as user input, therefore solving SQL injection.
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 built SQL queries by concatenating user input from the JSON 'name' parameter without using parameterised queries.
Impact
An attacker could access, leak, or corrupt sensitive data, and potentially compromise the entire database if administrative permissions are available.
What the attacker needed
Access to the API endpoint; ability to send POST requests
The fix
Use parameterised queries so that user input is treated as data, not as part of the SQL command.
How it was found
- Capture the POST request to the subtitle API endpoint.
- Identify the JSON 'name' parameter as the injection point.
- Use sqlmap with the captured request to confirm the injection and enumerate databases.
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 command, letting an attacker change the command's meaning. Here, the 'name' field in a JSON request was not properly separated from the SQL query, so an attacker could run their own database queries.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.