Skip to content
SQL injection Write-up Intermediate

MSSQL Injection In JSON Request

The OTP validation endpoint of an Android app was vulnerable to SQL injection via the DeviceId parameter in a JSON request. An attacker could confirm the injection with a time-delay payload and then execute arbitrary SQL, such as creating a database table.

Kailash Bohara Follow

Published on kailashbohara.com.np

Security engineer with 9 years of experience in penetration testing, security architecture, cloud security, zero trust implementation, and threat hunting.

Kailash Bohara, on kailashbohara.com.np

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 concatenated the DeviceId value directly into an SQL query without parameterisation or input validation.

Impact

An attacker could extract, modify or drop data and potentially gain OS or SQL shell access, though the report only demonstrates table creation.

What the attacker needed

Access to the Android app; ability to intercept HTTPS traffic; a phone number for OTP

How it was found

  1. Bypass SSL pinning to intercept the Android app's requests.
  2. Register an account and intercept the OTP validation request.
  3. Send the request to Burp Repeater and add a single quote to the DeviceId parameter.
  4. Observe an error response confirming the injection.
  5. Send time-delay payloads for several databases and note that the MSSQL delay payload worked.
  6. Use a stacked query to create a table as proof of concept.

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 query without proper handling, so an attacker can change the query's meaning. Here, the app took a device identifier from the request and put it into a database command, letting the tester make the database wait and then create a table.

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 Kailash Bohara

View all

7 more disclosed reports, best first.

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.