Skip to content
SQL injection Write-up Intermediate

How I got Time Based SQL Injection in an Old Public Bug Bounty Pr

A time-based SQL injection was found in the userId and accountId parameters of an AI chat integration API. An attacker could use it to dump the database.

Vishal Barot Follow

Published on medium.com

I have been doing bug hunting on this particular Bug Bounty Program since last 3 years, It’s a very old program yet I was able to find SQL Injection on it.

Vishal Barot, on medium.com

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 built SQL queries by concatenating user input directly into the query string without parameterisation or sanitisation.

Impact

An attacker could extract arbitrary data from the database, as demonstrated by dumping it with SQLMAP.

What the attacker needed

A logged-in user account; access to the AI chatbox feature

The fix

The bugs were fixed by the program after being reported.

How it was found

  1. Log in to the application and open the chatbox.
  2. Launch the AI chatbox and intercept the request to the chat-agent API.
  3. Send single and double quotes in each POST parameter to test for error-based SQL injection.
  4. Send time-based payloads in each parameter and observe response delays.
  5. Confirm the userId parameter is vulnerable by varying the sleep value and measuring response times.
  6. Use SQLMAP to dump the database and also test the accountId parameter.

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.

SQL injection is when user input is inserted into a database command without proper handling, letting an attacker change the command. Here, the userId and accountId values were used directly in a database query, so adding special characters caused the database to pause, which the attacker could measure to extract data.

What is SQL injection?

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

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.