Skip to content
SQL injection Write-up Beginner

Exploiting a SQL Injection Vulnerability in a WHERE Clause | Por

The application's product category filter was vulnerable to SQL injection because user input was concatenated directly into a SQL query. An attacker could manipulate the query to bypass the 'released' condition and retrieve hidden or unreleased products.

shivam sharma Follow

Published on medium.com

SQL Injection is one of the most common and dangerous web vulnerabilities. It occurs when user input is directly inserted into a SQL query without proper validation or sanitization.

shivam sharma, 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

The application directly concatenates user input into the SQL query without sanitisation or parameterisation.

Impact

An attacker could retrieve hidden or unreleased products from the database, bypassing the intended filtering condition.

What the attacker needed

Access to the lab environment; Burp Suite or similar proxy

The fix

The application should use parameterised queries (prepared statements) to separate SQL logic from user input.

How it was found

  1. Intercept the request to the category filter using Burp Suite Proxy.
  2. Send the request to Burp Suite Repeater to modify it manually.
  3. Modify the category parameter to inject a SQL condition that is always true and comment out the rest of the query.
  4. Send the modified request and observe that additional products, including unreleased ones, are displayed.

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. Here, the category filter was inserted into a database query, so an attacker could add extra instructions to change what the query does. This let them see products 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.