Vulnerability Detection

Learn about SQLMap's vulnerability detection capabilities

SQLMap provides powerful capabilities for detecting SQL injection vulnerabilities in web applications. This section covers the core detection features and how to optimize them for your specific testing scenarios.

Understanding SQLMap's Detection Process

SQLMap employs a systematic approach to detect SQL injection vulnerabilities:

  1. Parameter Analysis: SQLMap analyzes the target parameters (URL parameters, form data, cookies, etc.)
  2. Payload Injection: It injects specially crafted payloads designed to trigger SQL errors or behavioral changes
  3. Response Analysis: The tool examines server responses for signs of vulnerability
  4. Confirmation: SQLMap confirms vulnerabilities through multiple tests to minimize false positives

Basic Detection Example

sqlmap -u "http://vulnerable-website.com/page?id=1" --batch

When executed, SQLMap will:

  • Test the id parameter for various injection types
  • Automatically determine the database management system (DBMS)
  • Report detailed findings about any vulnerabilities discovered

Detection Capabilities

SQLMap can detect a wide range of SQL injection vulnerabilities:

Injection TypeDescriptionDetection Method
Boolean-based blindUses true/false conditions to extract dataAnalyzes differences in responses
Time-based blindUses time delays to infer dataMeasures response time variations
Error-basedExtracts data through error messagesAnalyzes error responses
UNION query-basedUses UNION SQL operator to extract dataCombines queries to retrieve data
Stacked queriesExecutes multiple SQL statementsTests for ability to run multiple queries

Key Detection Parameters

SQLMap offers several parameters to control the detection process:

sqlmap -u "http://example.com/page?id=1" --level=3 --risk=2 --technique=BEU

This command:

  • Sets test thoroughness to level 3 (includes cookies and HTTP headers)
  • Sets risk level to 2 (includes time-based tests)
  • Focuses on Boolean, Error, and UNION-based techniques

In This Section

Real-World Detection Scenario

In a penetration testing engagement, you might encounter a login form that appears secure. Here's how you might approach it with SQLMap:

# Capture the login request with a proxy tool and save to login.txt
sqlmap -r login.txt --level=5 --risk=3 --batch

This approach:

  • Tests all parameters in the login request
  • Uses the highest level of thoroughness
  • Employs aggressive testing techniques
  • Runs automatically without user interaction

By mastering SQLMap's vulnerability detection capabilities, you can efficiently identify SQL injection vulnerabilities in web applications while minimizing false positives and unnecessary server load.