Skip to content
SQL injection Write-up Beginner

Easy SQLi in Amazon subsidiary using Sqlmap

A SQL injection vulnerability existed in the ID parameter of the editUser endpoint on sell.souq.com, allowing an attacker to manipulate database queries. The author used boolean-based tests and sqlmap to extract database names, users, and hostnames.

Mostafa Mamdoh Follow

Published on hector0x.medium.com

Bounty$1,500 View original

Mostafa Mamdoh

Mostafa Mamdoh, on hector0x.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 concatenated user input directly into an SQL query without parameterisation or sanitisation.

Impact

An attacker could extract database names, users, and hostnames from a production instance holding real customer and seller data.

What the attacker needed

A staff account on sell.souq.com

The fix

The bug was resolved according to the timeline.

How it was found

  1. Log in and go to the users page, then use the add staff account form.
  2. Intercept the POST request to /users/editUser with Burp.
  3. Modify the id parameter by appending 'AND FALSE' and 'AND TRUE' and observe different response messages.
  4. Save the request to a file and run sqlmap with the -r, -p id, and -a options to extract data.

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's meaning. Here, adding 'AND TRUE' or 'AND FALSE' to an ID changed how many records were updated, showing the input was being run as SQL. An attacker could then use a tool to read data from the database.

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 Mostafa Mamdoh

View all

4 more disclosed reports, best first.

More from Amazon

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.