The Detection tab controls how SQLmap detects and confirms SQL injection vulnerabilities, including detection levels, risk levels, and specific injection techniques.
The Detection tab contains three main sections:
Parameter: --level=LEVEL
Description: Level of tests to perform (1-5)
Default: 1 (fastest, least thorough)
Level 1 (Fastest):
Level 2:
Level 3:
Level 4:
Level 5 (Slowest):
Parameter: --risk=RISK
Description: Risk of tests to perform (1-3)
Default: 1 (safest, least intrusive)
Risk 1 (Safest):
Risk 2:
Risk 3 (Most Aggressive):
Parameter: --technique=B
Description: Use boolean-based blind SQL injection
How it works: Compares true/false responses
Examples:
AND 1=1
(true condition)AND 1=2
(false condition)
Detection: Different responses for true vs falseParameter: --technique=E
Description: Use error-based SQL injection
How it works: Forces database errors to leak information
Examples:
AND 1/0
AND 'a'='b'
Detection: Database error messages in responseParameter: --technique=U
Description: Use union query SQL injection
How it works: Appends UNION SELECT to original query
Examples:
UNION SELECT NULL,NULL
UNION SELECT 1,2,3
Detection: Additional columns in result setParameter: --technique=S
Description: Use stacked queries SQL injection
How it works: Executes multiple queries in one request
Examples:
; SELECT * FROM users; --
; DROP TABLE temp; --
Detection: Multiple query executionParameter: --technique=T
Description: Use time-based blind SQL injection
How it works: Uses time delays to infer information
Examples:
AND IF(1=1, SLEEP(5), 0)
AND 1=IF(2>1, SLEEP(5), 0)
Detection: Response time differencesParameter: --technique=Q
Description: Use inline query SQL injection
How it works: Injects subqueries within the main query
Examples:
(SELECT * FROM users)
(SELECT COUNT(*) FROM admin)
Detection: Subquery results in responseParameter: --string=STRING
Description: String to match when query is evaluated to True
Example: --string="Welcome back"
Use Case: Custom true condition detection
Parameter: --not-string=STRING
Description: String to match when query is evaluated to False
Example: --not-string="Access denied"
Use Case: Custom false condition detection
Parameter: --regexp=REGEXP
Description: Regular expression to match when query is evaluated to True
Example: --regexp="Welcome.*admin"
Use Case: Pattern-based detection
Parameter: --not-regexp=REGEXP
Description: Regular expression to match when query is evaluated to False
Example: --not-regexp="Error.*denied"
Use Case: Pattern-based false detection
Parameter: --code=CODE
Description: HTTP status code indicating true condition
Example: --code=200
Use Case: Status code-based detection
Parameter: --titles
Description: Match HTML page titles for true conditions
Use Case: Title-based blind detection
Parameter: --texts
Description: Match HTML body text for true conditions
Use Case: Content-based blind detection
Detection Level: 3
Risk Level: 2
Techniques: BEUSTQ (All enabled)
Generated Command:
sqlmap -u "http://example.com/page.php?id=1" --level=3 --risk=2 --technique=BEUSTQ
Detection Level: 2
Risk Level: 1
Techniques: BEU (Boolean, Error, Union)
Generated Command:
sqlmap -u "http://example.com/product.php?id=1" --level=2 --risk=1 --technique=BEU
Detection Level: 5
Risk Level: 3
Techniques: BEUSTQ (All enabled)
Generated Command:
sqlmap -u "http://example.com/admin.php?id=1" --level=5 --risk=3 --technique=BEUSTQ
Detection Level: 3
Risk Level: 2
String Match: "Welcome admin"
Not String Match: "Access denied"
Techniques: BT (Boolean, Time-based)
Generated Command:
sqlmap -u "http://example.com/login.php?id=1" --level=3 --risk=2 --string="Welcome admin" --not-string="Access denied" --technique=BT
Detection Level: 4
Risk Level: 2
Techniques: T (Time-based only)
Generated Command:
sqlmap -u "http://example.com/search.php?q=test" --level=4 --risk=2 --technique=T
Problem: SQLmap reports no injection points Solutions:
--level=5
--technique=BEUSTQ
--risk=3
--string="unique content"
Problem: SQLmap reports vulnerabilities that don’t exist Solutions:
--risk=1
--technique=BEU
--not-string="error"
Problem: Detection phase takes too long Solutions:
--level=2
--technique=BE
--batch
-p param
Problem: Web Application Firewall blocks detection payloads Solutions:
--tamper=space2comment
Problem: Time-based detection unreliable or slow Solutions:
--time-sec=10