005 Lab-Blind-SQLi-WebAppSecurity
005 Lab-Blind-SQLi-WebAppSecurity
005 Lab-Blind-SQLi-WebAppSecurity
Purpose
In this lab, we are going to demonstrate how a Blind SQL injection is executed on a vulnerable
website and you will also be required to carry out some exercises. In contrast to SQL injection, for
Blind SQL Injection, the attacker does not get to see the results of the SQL query on the webpage, so
he is forced to use inference techniques:
1) Time-Based Blind SQL Injection
2) Boolean-Based (Truth-Based) Blind SQL Injection
1. Open the browser and open the URL: localhost/sqli-union and select Song ID ‘1’
The Ascii function gets a character and returns the Ascii value of that character. In this case, the
Ascii function has a call to the database function as an argument. The database function returns the
name of the database, but since we have specified parameters (1,1) then this would return just the
first character of the database name. Thus, the substring would get the first character of the database
name and the Ascii function would convert this character to its corresponding value, and compare it
to Ascii equivalent of 67 which is ‘C’. Please refer to the Ascii table below:
2. Our database is actually named “Information”, so let’s try for the first character to be ‘I’
(Ascii=73):
localhost/sqli-union/sql-union.php?id=1’ AND Ascii(substring(database(),1,1))=’73
Since the query executed successfully, and even though we don’t get to see the database name on
screen, but we can infer that the first character of the database name is ‘I’. Thus, this process can be
continued through the use of automated scripts to enumerate the database name.
Task:
We have purposefully left out the implementation of the time-based blind SQL injection query to test
the first character of our database and we only checked if ‘1’=’1’. See if you can craft a query which
allows you to use time-based inference to check if the first character of the database name is ‘I’.