Skip to content
SQL injection Write-up Intermediate

Weirdest API that has been ever found

An online marketplace app exposed a single API endpoint that accepted raw SQL queries from the client, so any user could run arbitrary database statements. The author showed they could create a new table, insert rows and could modify or drop existing tables, which could flood storage or break the database.

mmaulanaabdullah Follow

Published on medium.com

An API (Applicable Programming Interface) is a service bridge to fulfill what users need based on resources what it has in the backend and follow a certain contract.

M Maulana Abdullah, 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 server passed a client-supplied query parameter straight to the database instead of using fixed, server-side queries with proper access control.

Impact

A user could create, modify or delete database tables, and at worst flood storage so the database could not operate properly.

What the attacker needed

The marketplace app; network access to the API

The fix

The API should be rebuilt so the server runs fixed queries and the database user has restricted permissions, rather than accepting raw queries from clients.

How it was found

  1. Send a request to the endpoint with a query parameter containing a database statement to create a table
  2. Observe that the new table appears in the database
  3. Send a statement to insert a row into the new table
  4. Observe the inserted row and the increased table count

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.

The app's server had an endpoint that simply ran whatever database command the app sent it. Because the app sent those commands from the user's device, anyone could send their own commands instead, such as creating or deleting tables. This is dangerous because the database is meant to be controlled only by 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 mmaulanaabdullah

View all

1 more disclosed report, 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.