#2. Bug Bounty POC: Time-Based SQL Injection to Dump Database
An API endpoint accepted an employee ID parameter that was passed into a database query without proper handling, so a crafted value caused a measurable server delay. The author used that delay to extract database names, tables and columns, and reported it; the program fixed it within a day.
Hello👋 and welcome, fellow cyber explorers!. Today, I’m excited to share my latest write-up on time-based SQL injection💉, where I’ll walk you through the method of extracting data from a database through Time-Based SQL Injection.
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 employee ID parameter was concatenated into a SQL query without parameterisation, letting injected database expressions run.
Impact
An attacker could extract sensitive database contents such as usernames and passwords, learn the schema, and potentially degrade performance with long-running queries.
What the attacker needed
Installed Android app; SSL pinning bypass (Frida); valid API request to the endpoint
The fix
The issue was fixed by the program within a day of the report.
How it was found
- Install the app and try to log in; SSL pinning blocks it, so bypass it with Frida (okhttp3 pinning remained).
- Inspect the login and other API requests in the proxy history.
- Notice the employee ID parameter in the business KPI endpoint.
- Send a single quote in that parameter and observe a 500 Internal server error.
- Send a boolean-style condition and see the returned data change.
- Run SQLMAP against the saved request with the time-based technique to dump databases, tables and columns.
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.
A database query is a question the app asks its database, and the app builds that question partly from values you send. If those values are not handled safely, you can add your own database instructions. Here the attacker could not see data directly, so they made the database pause on purpose and used the pause as a yes/no signal to slowly read 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.