07 - SQL injection UNION attack, determining the number of columns returned by the query
To solve the lab, determine the number of columns returned by the query by performing a SQL injection UNION attack that returns an additional row containing null values.
Given : Injection point (Product category)
End goal : Use union attack to determine number of columns in the table
As we already know to get the numbers of columns by using order by, there is an another method which can be used to get the number of column by using NULL value.
It gives 200OK only if the number of null is equal to the number of columns. If we use a single NULL the it gives 500 Internal Server Error
If we use 2 NUll values , it still gives 500 Internal Server Error :
But if we use 3 null values the it gives 200 OK :
That means there are 3 columns in the table