Skip to content
SQL injection Write-up Beginner

How I Found a SQL Injection Vulnerability in website

The manufacturer parameter on an ecommerce site was vulnerable to SQL injection, allowing an attacker to manipulate database queries. The author demonstrated extracting database names, table names, and email addresses from a userdata table.

medium.com

Published on medium.com

While browsing an ecommerce website, I found an interesting sql injection vulnerability. In this blog, I’ll walk you through how I discovered it using two approaches: manual testing and automation with SQLmap.

Bl4cky, 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 manufacturer parameter was concatenated into an SQL query without proper sanitisation or parameterisation.

Impact

An attacker could read sensitive data from the database, including user email addresses, as demonstrated by the extraction.

What the attacker needed

None

How it was found

  1. Send a single quote in the manufacturer parameter and observe a syntax error.
  2. Use ORDER BY with increasing numbers to find the number of columns.
  3. Use UNION SELECT with NULL values to confirm the column count.
  4. Extract table names from information_schema.tables.
  5. Extract column names from information_schema.columns for the userdata table.
  6. Extract email addresses from the userdata table.

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 a website puts user input directly into a database command without checking it. An attacker can add extra database instructions to make the site reveal private information, like user emails.

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.