SQLMap Evasion and Tampering Scripts
What you'll learn: How to use SQLMap's built-in techniques to bypass Web Application Firewalls (WAFs) and filters that would normally block SQL injection attempts.
Why Evasion Matters
You've learned how to exploit SQL injection vulnerabilities with SQLMap, but in the real world, many applications sit behind Web Application Firewalls (WAFs) that detect and block common injection patterns. Think of a WAF as a security guard who recognizes suspicious behavior—if you walk straight at them, you'll get stopped. But if you disguise yourself or take a side entrance, you might slip through.
Tamper Scripts: Your Disguise Toolkit
SQLMap includes tamper scripts—Python modules that automatically modify your injection payloads to evade detection. These scripts encode, obfuscate, or transform your SQL payloads before sending them.
Common tamper scripts:
space2comment— replaces spaces with SQL comments (/**/)charencode— URL-encodes all charactersrandomcase— randomizes character casing (e.g.,SeLeCT)between— replaces comparison operators withBETWEENequivalents
Usage example:
sqlmap -u "http://target.com/page?id=1" --tamper=space2comment,randomcase
You can chain multiple tamper scripts together for layered obfuscation.
Additional Evasion Options
- Random User-Agent rotation:
--random-agentdisguises SQLMap traffic as various browsers - Proxy configuration:
--proxy=http://127.0.0.1:8080routes traffic through Burp Suite or other tools for additional manipulation - Delays and throttling:
--delay=2adds pauses between requests to avoid rate-limiting triggers - Custom headers:
--headers="X-Forwarded-For: 192.168.1.1"can bypass IP-based filters
Choosing the Right Approach
Start simple and escalate. If basic SQLMap gets blocked, add --random-agent, then try a single tamper script, then combine multiple techniques until you find what works against the target's defenses.
Key Takeaway: SQLMap's tamper scripts and evasion options transform your payloads to bypass WAFs and filters, acting like disguises that help your injection attempts slip past security controls without triggering detection rules.