SQL injection vulnerability in WHERE clause allowing retrieval of hidden data
Lab 1 regarding the SQL Injection vulnerability from PortSwigger.
Last updated
Lab 1 regarding the SQL Injection vulnerability from PortSwigger.
Last updated
In the laboratory description, it is proposed that there is a SQL Injection vulnerability in the category filtering field.
The query performed on the database is exactly as follows:
Given that there is no validation on the "category" parameter, we can effectively subvert the logic of the query to retrieve all product categories.
By using a payload like gifts' OR 1=1--
, the query would look like this:
Thus, the query will check if there is a category called "gifts" or if 1=1
, which is always true. As a result, the application returns all categories, and the lab is successfully solved!