How I Found a SQL Injection on an E-Commerce Platform — Step-by-Step Bug Bounty Guide
The search function on an e-commerce site passed user input directly into a SQL query without sanitisation. An attacker could inject SQL commands to read database contents, including user and payment tables.
Published on medium.com
SQL injection remains one of the most critical vulnerabilities affecting web applications, especially platforms that deal with user inputs and databases — like e-commerce sites.
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 search parameter was concatenated directly into a SQL query without parameterisation or sanitisation.
Impact
An attacker could potentially leak user data or compromise the entire database, though the reporter stopped after listing table names and did not exfiltrate sensitive data.
What the attacker needed
A free buyer account; access to the search feature
The fix
The endpoint was fixed 48 hours after the report; the suggested fix was to use parameterised queries, input sanitisation, and a WAF.
How it was found
- Create a buyer account and browse the site while intercepting requests.
- Identify the search request that sends a query parameter.
- Send a single quote in the search term and observe a 500 error with a SQL syntax message.
- Send a time-based payload and note the page takes about five seconds to load.
- Send true and false conditions to confirm boolean-based injection.
- Use an automated tool to enumerate the database and table names.
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 what you type into a database command without cleaning it first. By typing special characters, an attacker can change the command and make the database reveal information it should not. Here, the search box was the weak point.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.