Skip to content
SQL injection Write-up Beginner

The Quote That Opened the Whole Store

The application built SQL queries by concatenating user input from the category parameter, so a single quote caused a database error and an OR 1=1 payload bypassed the released filter to show unreleased products. An attacker could view hidden items and potentially extract arbitrary data.

medium.com

Published on medium.com

A new series starts today. I closed out Information Disclosure — secrets left lying around.

morgan_hack, 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

Impact

An attacker could bypass the released filter to view unreleased products and potentially extract other database contents.

What the attacker needed

None

The fix

The application should use parameterised queries (prepared statements) so user input is passed as data, not as part of the SQL command.

How it was found

  1. Open the shop in a proxy tool and observe that clicking a category changes the URL parameter.
  2. Send a normal category request to establish a baseline response.
  3. Change the category value to include a single quote and send it, observing a 500 error.
  4. Change the value to include a true OR condition and a comment to remove the released filter, then send it.
  5. Observe that products from all categories, including unreleased items, are returned.

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.

A website asks its database for information using a language called SQL. If the site pastes what you type directly into that question without checking it, you can add extra instructions. Here, adding a quote mark and a true statement made the database return everything, including items that were supposed to be hidden.

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.