Boolean-based (content-based) Blind SQLi By ITSec Security Consulting Limited
Boolean-based (content-based) Blind SQLi By ITSec Security Consulting Limited
Boolean-based (content-based) Blind SQL Injection (SQLi) is a type of SQL injection attack where an attacker sends SQL queries to the database that force the application to return different results based on whether the query returns a TRUE or FALSE result. This type of attack is called “blind” because the attacker does not directly see the results of the query but can infer information based on the application’s behavior.

Overview of Boolean-based Blind SQLi
In a Boolean-based Blind SQLi attack, the attacker exploits vulnerabilities in the application’s input validation to inject malicious SQL code. The goal is to extract information from the database by observing the application’s responses to different queries. The attacker typically uses conditional statements in the SQL query to determine whether a certain condition is TRUE or FALSE.
How Boolean-based Blind SQLi Works
- Identifying Vulnerable Input: The attacker identifies an input field in the application that is vulnerable to SQL injection. This could be a search box, login form, or any other input field that interacts with the database.
- Crafting Malicious Queries: The attacker crafts SQL queries that include conditional statements. These queries are designed to return different results based on whether the condition is TRUE or FALSE.
- Observing Application Behavior: The attacker submits the malicious queries and observes the application’s behavior. Based on the application’s response, the attacker can infer whether the condition in the query was TRUE or FALSE.
Example of Boolean-based Blind SQLi
Let’s consider a simple example of a vulnerable login form. The application uses the following SQL query to authenticate users:
sql
SELECT * FROM users WHERE username = 'user' AND password = 'pass';
An attacker can exploit this query by injecting a conditional statement into the username
field:
sql
SELECT * FROM users WHERE username = 'user' AND 1=1 -- ' AND password = 'pass';
In this query:
1=1
is always TRUE, so the query will return a result if theusername
exists in the database.- The
--
comment sequence ignores the rest of the query, effectively bypassing the password check.
The attacker can then modify the query to test different conditions and infer information from the application’s response.
Steps to Perform Boolean-based Blind SQLi
- Initial Test: The attacker submits a query with a simple condition to test if the input is vulnerable to SQL injection. For example:
- sql
' OR 1=1 --
- If the application returns a different response, it indicates that the input is vulnerable.
- Extracting Information: The attacker crafts queries to extract information from the database. For example, to determine the length of a username:
- sql
' AND LENGTH(username) = 5 --
- If the application returns a different response, it indicates that the length of the username is 5.
- Retrieving Data: The attacker continues to craft queries to retrieve specific data. For example, to determine the first character of the username:
- sql
' AND SUBSTRING(username, 1, 1) = 'a' --
- If the application returns a different response, it indicates that the first character of the username is ‘a’.
Mitigation Techniques
To protect against Boolean-based Blind SQLi attacks, developers should implement the following mitigation techniques:
- Input Validation: Validate and sanitize all user inputs to ensure they do not contain malicious SQL code.
- Parameterized Queries: Use parameterized queries or prepared statements to prevent SQL injection. These techniques ensure that user inputs are treated as data, not executable code.
- Stored Procedures: Use stored procedures to encapsulate SQL queries and reduce the risk of SQL injection.
- Least Privilege Principle: Limit the database permissions of the application to only what is necessary. This reduces the potential impact of a successful SQL injection attack.
- Web Application Firewalls (WAF): Deploy a WAF to detect and block SQL injection attempts.
Conclusion
Boolean-based Blind SQLi is a powerful attack technique that allows attackers to extract information from a database without directly seeing the query results. By carefully crafting conditional statements and observing the application’s behavior, attackers can infer sensitive information. Implementing robust input validation, parameterized queries, and other security measures can help protect applications from this type of attack.
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

ITSec Security Consulting Limited
IT Security Assessment And Audit, SRAA, Penetration Test (Pen Test),Compliance, Data Security,ISO 27001 Audit, GDPR Audit, PCI DSS, Cyber Security, Risk assessment, Data Protection, Data Privacy, SOX, CISA, CEH,CISSP, CISM
Secure Your Computers from Cyber Threats and mitigate risks with professional services to defend Hackers.
Contact Us:
Find Us immediately for the Security Assessment in Hong Kong(HK), United Kingdom(UK), Europe(EU), Estonia(EE), Singapore(SG), Canada(CA):
Website:
Facebook:
https://www.facebook.com/ITSec-Security-Co...
Google:
https://itsecsecurityconsulting.business.s...
Contact Us:
It is for blind sql injection of pentest (penetration test) or sraa (IT Security Risk Assessment and Audit)
回覆刪除Up
刪除It is nice
回覆刪除Yes, a nice guide for penetration tests and it security assessment
刪除A nice shoot for penetration test
回覆刪除A nice pentest and sraa guide
回覆刪除Yes, specifically for sraa and pentest
刪除It is nice
回覆刪除作者已經移除這則留言。
刪除Agree
刪除A good sraa and pentest guide
刪除Pentest and SRAA note
回覆刪除Up
刪除Great job for sraa and pentest introduction
刪除It is great
回覆刪除It is great and good for sraa and pentest
回覆刪除It is good for sraa and pentest
回覆刪除