Blind SQL Injection
Blind SQL Injection
Description
Blind SQL (Structured Query Language) injection is a type of SQL
Injection attack that asks the database true or false questions and
determines the answer based on the applications response. This
attack is often used when the web application is configured to show
generic error messages, but has not mitigated the code that is
vulnerable to SQL injection.
When an attacker exploits SQL injection, sometimes the web
application displays error messages from the database complaining
that the SQL Query's syntax is incorrect. Blind SQL injection is
nearly identical to normal SQL Injection, the only difference being
the way the data is retrieved from the database. When the database
does not output data to the web page, an attacker is forced to steal
data by asking the database a series of true or false questions. This
makes exploiting the SQL Injection vulnerability more difficult, but
not impossible. .
Threat Modeling
Same as for SQL Injection
Risk Factors
Same as for SQL Injection
Examples
An attacker may verify whether a sent request returned true or false
in a few ways:
Content-based
Using a simple page, which displays an article with given ID as the
parameter, the attacker may perform a couple of simple tests to
determine if the page is vulnerable to SQL Injection attacks.
Example URL:
http://newspaper.com/items.php?id=2
The attacker may then try to inject a query that returns 'false':
http://newspaper.com/items.php?id=2 and 1=2
If the content of the page that returns 'true' is different than that of
the page that returns 'false', then the attacker is able to distinguish
when the executed query returns true or false.
Once this has been verified, the only limitations are privileges set up
by the database administrator, different SQL syntax, and the
attacker's imagination.
Time-based
This type of blind SQL injection relies on the database pausing for a
specified amount of time, then returning the results, indicating
successful SQL query executing. Using this method, an attacker
enumerates each letter of the desired piece of data using the
following logic:
If the first letter of the first database's name is an 'A', wait for 10
seconds.
If the first letter of the first database's name is an 'B', wait for 10
seconds. etc.
Microsoft SQL Server
http://www.site.com/vulnerable.php?id=1' waitfor
delay '00:00:10'--
MySQL
If the database response took a long time, we may expect that the
first user password character with user_id = 1 is character '2'.
(CHAR(50) == '2')
PostgreSQL - pg_sleep()
Related Attacks
Blind_XPath_Injection
SQL_Injection
XPATH_Injection
LDAP_injection
Server-Side_Includes_(SSI)_Injection
Related Vulnerabilities
Injection_problem
Related Controls
Category:Input Validation
See the OWASP Testing Guide article on how to Test for SQL
Injection Vulnerabilities.
References
http://www.cgisecurity.com/questions/blindsql.shtml
http://www.imperva.com/application_defense_center/white_pap
ers/blind_sql_server_injection.html
http://www.securitydocs.com/library/2651
http://seclists.org/bugtraq/2005/Feb/0288.html
http://ferruh.mavituna.com/makale/sql-injection-cheatsheet/
Online Resources
http://www.imperva.com/resources/whitepapers.asp?t=ADC
Tools
Injection
Attack
Navigation menu
Log in
Request account
Read
View source
View history
Go
Home
About OWASP
Acknowledgements
Advertising
AppSec Events
Books
Brand Resources
Chapters
Donate to OWASP
Downloads
Funding
Governance
Initiatives
Mailing Lists
Membership
Merchandise
News
Community portal
Presentations
Press
Projects
Video
Volunteer
Page
Discussion
Reference
Activities
Attacks
Code Snippets
Controls
Glossary
How To...
Java Project
.NET Project
Principles
Technologies
Threat Agents
Vulnerabilities
Language
Tools
Privacy policy
About OWASP
Disclaimers