Overview
SQL Injection (SQLi) remains one of the most critical web application vulnerabilities. These tools help security professionals identify, test, and exploit SQL injection flaws in web applications, databases, and APIs. They automate detection, dumping databases, and demonstrating the impact of SQLi vulnerabilities.Use Cases
- Vulnerability Assessment: Identify SQL injection points
- Penetration Testing: Exploit SQLi to demonstrate impact
- Database Enumeration: Extract database structure and data
- Security Research: Analyze SQLi attack vectors
- Bug Bounty Hunting: Find and report SQLi vulnerabilities
Available Tools
SQLMap
The most powerful automated SQLi tool
NoSQLMap
NoSQL database injection and exploitation
DSSS
Damn Small SQLi Scanner - lightweight scanner
Explo
Web security issue description framework
Blisqy
Time-based blind SQL injection exploiter
Leviathan
Wide-range mass audit toolkit with SQLi
SQLScan
Quick web scanner for SQL injection points
SQLMap
Description
SQLMap is the industry-standard open source penetration testing tool that automates detecting and exploiting SQL injection flaws. It supports all major database management systems and provides powerful features for database fingerprinting, data extraction, and even operating system takeover.Installation
Basic Usage
Advanced Features
Database Enumeration
Database Enumeration
Authentication Bypass
Authentication Bypass
Advanced Exploitation
Advanced Exploitation
Important Options
| Option | Description | Example |
|---|---|---|
-u | Target URL | -u "http://site.com?id=1" |
--data | POST data | --data="user=admin&pass=x" |
-p | Testable parameter | -p id |
--cookie | HTTP Cookie value | --cookie="session=abc123" |
--level | Test level (1-5) | --level=3 |
--risk | Risk level (1-3) | --risk=2 |
--dbs | Enumerate databases | --dbs |
-D | Specify database | -D mydatabase |
-T | Specify table | -T users |
--dump | Dump table data | --dump |
--batch | Never ask for input | --batch |
--random-agent | Use random User-Agent | --random-agent |
--tor | Use Tor network | --tor |
Usage Examples
Performance: Use
--threads=10 for faster scanning, but be cautious as high thread counts may crash the application or trigger security alerts.NoSQLMap
Description
NoSQLMap is designed to audit and automate injection attacks against NoSQL databases like MongoDB, CouchDB, and Redis. As NoSQL databases gain popularity, testing for NoSQL injection becomes increasingly important.Installation
Running
Features
- MongoDB injection detection
- CouchDB exploitation
- Redis command injection
- Automated data extraction
- Authentication bypass
DSSS - Damn Small SQLi Scanner
Description
DSSS is a lightweight, fully functional SQL injection vulnerability scanner supporting both GET and POST parameters. Perfect for quick scans and integration into automated workflows.Installation
Usage
Features
- Fast scanning (typically under 100 requests)
- Minimal false positives
- GET and POST support
- Cookie-based testing
- Lightweight and portable
Explo
Description
Explo is a tool to describe web security issues in both human and machine-readable format (YAML). It’s useful for documenting and sharing SQLi findings in a standardized way.Installation
Usage
Blisqy
Description
Blisqy specializes in finding and exploiting time-based blind SQL injection vulnerabilities in HTTP headers. This is particularly useful when traditional injection points are protected but headers are not.Installation
Usage
Time-Based Blind SQLi
What is Time-Based Blind SQLi?
What is Time-Based Blind SQLi?
Time-based blind SQL injection exploits the ability to make the database sleep/delay:Example payloads:Detection:
- Normal response: < 1 second
- Vulnerable response: 5+ seconds
Leviathan
Description
Leviathan is a comprehensive mass audit toolkit with service discovery, brute-force capabilities, SQL injection detection, and running custom exploits. Requires API keys for full functionality.Installation
Running
Features
- Mass vulnerability scanning
- Service discovery
- SQL injection testing
- Brute-force capabilities
- Custom exploit integration
- API integration (Shodan, Censys)
SQLScan
Description
SQLScan is a quick web scanner specifically designed to find SQL injection points rapidly. Written in PHP, it’s fast and easy to use.Installation
Running
SQL Injection Types
Classic SQL Injection
Blind SQL Injection
Second-Order SQL Injection
Payload is stored in database and executed in a different context later.Out-of-Band SQL Injection
Best Practices
Testing Methodology
-
Identify Injection Points
- URL parameters
- POST data
- Cookies
- HTTP headers
- File uploads
-
Test for Vulnerability
-
Determine Database Type
-
Exploit Systematically
- Enumerate databases
- Extract table structure
- Dump sensitive data
- Assess further access
Avoiding Detection
Documentation
Report Writing: Document all findings:
- Injection point (parameter, header, etc.)
- Payload used
- Database type and version
- Data extracted
- Impact assessment
- Remediation recommendations
Defense Mechanisms
After testing, recommend these protections:Prepared Statements (Best Defense)
Input Validation
Other Protections
- Least Privilege: Database user should have minimal permissions
- WAF: Web Application Firewall for additional layer
- Escaping: Last resort, not recommended as primary defense
- Error Handling: Don’t expose database errors to users
- Monitoring: Log and alert on suspicious patterns
Troubleshooting
SQLMap Not Detecting Vulnerability
SQLMap Not Detecting Vulnerability
Solutions:
- Increase level:
--level=5 - Increase risk:
--risk=3 - Test all parameters:
-p "*" - Try different techniques:
--technique=BEUSTQ - Check for WAF:
--identify-waf - Bypass WAF:
--tamper=space2comment
False Positives
False Positives
Verification:
- Manually test the payload
- Check response differences
- Verify with alternative tools
- Test with known-safe input
- Examine actual database behavior
Slow Performance
Slow Performance
Optimization: