Content-based Blind SQL Injection attacks
In the case of the Content-based Blind SQL Injection, an attacker performs various SQL queries that claim the database TRUE or FALSE responses. Then the attacker observes differences between TRUE and FALSE statements.
Here is an example of an online webshop, which displays items for sale. The following link displays details about the item with ID 14, that is retrieved from a database.
http://www.webshop.local/item.php?id=14
The SQL query used to get this request is:
SELECT columnName, columnName2 FROM table_name WHERE id = 14
The attacker manipulates the request into:
http://www.webshop.local/item.php?id=14 and 1=2
Now, the SQL query looks like:
SELECT columnName2 FROM tableName WHERE ID = 14 and 1=2SELECT name, description, price FROM StoreTable WHERE ID = 14 and 1=2
This results in the query returning FALSE with no items displayed in the list. The attacker then proceeds to modify the request to:
http://www.webshop.local/item.php?id=14 and 1=1
Now, the SQL query looks like:
SELECT columnName, columnName2 FROM tableName WHERE ID = 14 and 1=1SELECT name, description, price FROM StoreTable WHERE ID = 14 and 1=1
The database will return TRUE, and the details of the item with ID 14 are displayed. This is an indication that this webpage is vulnerable.
Time-based Blind SQL Injection
In this case, the attacker performs a database time-intensive operation.
If the website does not return an immediate response, it indicates a vulnerability to Blind SQL Injection. The most popular time-intensive operation is a sleep operation.
If the website does not return an immediate response, it indicates a vulnerability to Blind SQL Injection. The most popular time-intensive operation is a sleep operation.
Based on the example above, the attacker would benchmark the web server response time for a regular SQL query, and then would issue the request below:
http://www.webshop.local/item.php?id=14 and if(1=1, sleep(15), false)
The website is vulnerable if the response is delayed by 15 seconds.
Comments
Post a Comment