Lab: SQL injection UNION attack, determining the number of columns returned by the query
This lab contains an SQL injection vulnerability in the product category filter. The results from the query are returned in the application's response, so you can use a UNION attack to retrieve data from other tables. The first step of such an attack is to determine the number of columns that are being returned by the query. You will then use this technique in subsequent labs to construct the full attack.
To solve the lab, determine the number of columns returned by the query by performing an SQL injection UNION attack that returns an additional row containing null values.
- Use Burp Suite to intercept and modify the request that sets the product category filter.
categoryparameter, giving it the value
'+UNION+SELECT+NULL--. Observe that an error occurs.
categoryparameter to add an additional column containing a null value:
- Continue adding null values until the error disappears and the response includes additional content containing the null values.