SQL injection in the WHERE clause: how to reach unreleased products (PortSwigger)
Another lab from PortSwigger Academy: SQL injection vulnerability in WHERE clause allowing retrieval of hidden data . The goal is simple: display one or more unreleased products via SQL injection.
Starting point
The shop filters products by category. In Burp I intercepted the request for opening a product description. The GET request includes the parameter productID=6 , the product number.
Hypothesis
Task tells us that server-side SQL query contains a released = 1 condition. If so, perhaps released = 0 would show products that haven't gone on sale yet. So the trick is to make that condition stop applying.
Where I got stuck
I forgot that closing the query takes more than an apostrophe ' . You also need to comment out the rest of the statement , which is what the double dash -- does. Without it, the remainder of the query either breaks the syntax or keeps filtering the results.
Then came a second problem.…