sqlmap

A command-line tool that automatically checks a web app's inputs and parameters for SQL injection. You can compare the results before and after a fix.

cat sqlmap/meta.ymlChecked on 2026-10-27

Safety

Impact Can harm othersCan do real harm to others: intrusion, tampering, or load
Admin rights
Not required
Test lab
Required

Usage

Purpose
Audit
Difficulty
Intermediate
Type
Command line
Platforms
Windows / macOS / Linux

Trust

Repository
sqlmapproject/sqlmap
License
CopyleftGPL-2.0-or-later(独自の解釈と例外つき)
GitHub
stars38,9722026-11-17
Maintenance
Actively updatedLast update 2026-11-12
Contents
  1. Introduction
  2. What sqlmap does
  3. Network traffic
  4. Even the defaults load and change the target
  5. Try it safely: confirm a fix on your own app
  6. Common uses
  7. How to read a “not detected” result
  8. How sqlmap differs from ZAP
  9. Cautions
  10. Read next
  11. Sources

This tool can also be used for attacks. Use it only on systems you own or have written permission to test.

sqlmap automatically checks whether a web app’s parameters are open to SQL injection. Its README describes it as a penetration testing tool that automates detecting and exploiting SQL injection flaws and taking over database servers. It can also read data out of the database and reach the server’s files and commands.

This review does not cover those attack features. It covers only one use: checking whether an app you are building has SQL injection, and confirming the flaw is gone after you fix it.

This review is for developers who build web apps backed by a database. After reading it, you can do the following:

  • Run detection only against your own app on your own computer
  • Tell an “injectable” result from a “not injectable” one
  • Fix the query with placeholders, run sqlmap again, and confirm the flaw is no longer detected

What sqlmap does

  • Detection: Sends requests with crafted parameter values and finds SQL injection from changes or delays in the responses.
  • Technique identification: When it finds a flaw, it shows which techniques work (boolean-based blind, time-based blind, UNION query, and so on) and which database is behind the app.
  • Input options: Besides a URL, it can test a saved HTTP request (-r), a POST body (--data), the forms on a page (--forms), or an OpenAPI definition (--openapi).
  • Test depth: --level (1–5) sets how much it tests and where. --risk (1–3) sets how dangerous the test values can be.
What it doesn’t doBy default, sqlmap looks for SQL injection. Options let it also try injection into LDAP, NoSQL, and more, but it does not check for XSS or broken access control. For a broader check, combine it with ZAP.

Network traffic

  • It sends many crafted requests to the target you specify. With --crawl, it also follows pages within the target site. With --forms, it fills in and submits the forms on the page.
  • With --update, it fetches the latest version from GitHub.
  • It saves results and sessions locally. On Windows the default location is under %LOCALAPPDATA%\sqlmap. You can change it with --output-dir.

Even the defaults load and change the target

The official wiki says the default --risk 1 is innocuous for the majority of injection points. It does not say it is harmless for all of them.

--risk 2 adds tests that slow down responses with heavy queries, and --risk 3 adds tests that use OR. According to the official wiki, if the injection point is in an UPDATE statement, an OR-based value can update every row in the table. That is why this review rates its impact as “high.”

Even with your own app, don’t point it at a database with data you can’t afford to lose.

Try it safely: confirm a fix on your own app

These steps assume you run the app you are building on your own computer, connected to a test database. We checked them on October 27, 2026, with Windows 11, Python 3.12, and sqlmap 1.10.10.

  1. Check that Python 3 is installed. According to the README, sqlmap works with Python 2.7 and 3.x and needs nothing else installed.

  2. Get the official repository.

    git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
  3. Start your app and check that it opens on 127.0.0.1. This example assumes a URL of http://127.0.0.1:8765/items?id=1.

  4. Run detection only, with the default settings. --batch answers every prompt with the default choice.

    python sqlmap-dev/sqlmap.py -u "http://127.0.0.1:8765/items?id=1" --batch
  5. Read the result. If the parameter is injectable, the working techniques are listed under Parameter: id (GET) as Type: and Title: lines. If it is not, sqlmap prints all tested parameters do not appear to be injectable.

  6. If sqlmap finds a flaw, rewrite the query with placeholders. With Python’s sqlite3, stop joining the value into the SQL string, as shown below.

    # Before: the input becomes part of the SQL
    db.execute("SELECT name FROM items WHERE id = " + q)
    # After: the input is passed only as a value
    db.execute("SELECT name FROM items WHERE id = ?", (q,))
  7. Restart the app and run sqlmap again with --flush-session, which discards the previous results. sqlmap saves results for each target and reuses them unless you add this option.

    python sqlmap-dev/sqlmap.py -u "http://127.0.0.1:8765/items?id=1" --batch --flush-session
  8. If sqlmap prints all tested parameters do not appear to be injectable, the flaw is no longer detected by the default tests.

In our check, the version that joined strings was detected with three techniques: boolean-based blind, time-based blind, and UNION query. The version fixed with placeholders was not detected.

Common uses

Goal How
Test GET parameters -u "<URL>?id=1"
Test pages behind a login, or POST requests Save the request from your browser’s developer tools or ZAP and pass it with -r <file>
Test specific parameters only -p <name>
Also test cookies and the User-Agent --level 2 (cookies), --level 3 (User-Agent and Referer)
Test again without the previous results --flush-session

Raising --level increases the number of requests and the places sqlmap tests. As described above, raising --risk increases the chance of changing data. When you raise it, point sqlmap at a test database that you can afford to break.

How to read a “not detected” result

“Not detected” does not always mean “safe.”

  • It covers only what the default --level 1 and --risk 1 tested. As sqlmap’s message says, higher values run more tests.
  • sqlmap tests only the parameters of the URL or request you give it. You need to test other pages and APIs separately.
  • The reliable check is to confirm in the code that no value is joined into SQL. The OWASP cheat sheet names placeholders (parameterized queries) as the primary defense. For parts that cannot be placeholders, such as table names or ASC/DESC, choose from a fixed set of options defined by the app. It strongly discourages manual escaping.
  • To limit damage, give the database account your app uses only the permissions it needs. OWASP describes this as a way to limit damage, not a way to prevent injection.

How sqlmap differs from ZAP

sqlmap ZAP
What it checks SQL injection (other injection types with options) A wide range, including XSS and misconfiguration
Interface Command line GUI (command line in Docker)
SQL injection findings Shows the techniques and the database type Shows them as one kind of alert

You can check the whole app with ZAP, then use sqlmap to look closely at places where ZAP suspects SQL injection.

Cautions

  • Use sqlmap only on your own apps and on apps you have written permission to test. Each time it starts, sqlmap shows a notice that attacking targets without prior mutual consent is illegal.
  • Don’t point it at production. Even the defaults send a large number of crafted requests.
  • If you run a WAF or log monitoring, check whether the test requests were logged or blocked. This also tests your detection. The default User-Agent contains the name sqlmap. But --random-agent changes it, so don’t rely on the User-Agent alone for defense.
  • The results folder keeps the target URL, the command you ran, and a record of the injection points found. Delete it when you are done.

Sources

  1. Official repository (sqlmapproject/sqlmap)github.com/sqlmapproject/sqlmap
  2. LICENSEgithub.com/sqlmapproject/sqlmap/blob/master/LICENSE
  3. Official wiki: Usagegithub.com/sqlmapproject/sqlmap/wiki/Usage
  4. OWASP SQL Injection Prevention Cheat Sheetcheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html

Checked on 2026-10-27

Similar tools

OWASP Juice Shop

Impact Local only
juice-shop/juice-shop

An intentionally vulnerable online shop for practice. Run it on your own computer to learn how web vulnerabilities work and to try out security testing tools.

Purpose
Learning
Type
Practice lab
Difficulty
Beginner
License
PermissiveMIT
Category
Learning and practice labs / Web security
Actively updatedstars14,458Last update 2026-11-11
Read the OWASP Juice Shop review

Nuclei

Impact Can harm others
projectdiscovery/nuclei

A command-line scanner that sends requests following steps written in YAML templates and checks the responses for known vulnerabilities and misconfigurations.

Purpose
Audit
Type
Command line
Difficulty
Intermediate
License
PermissiveMIT
Category
Vulnerability scanning / Web security
Actively updatedstars33,014Last update 2026-11-16
Read the Nuclei review

ZAP

Impact Can harm others
zaproxy/zaproxy

A free web app scanner that sits between your browser and a web app, records the traffic, and looks for vulnerabilities. Formerly OWASP ZAP, now ZAP by Checkmarx.

Purpose
Audit
Type
Desktop app
Difficulty
Intermediate
License
PermissiveApache-2.0
Category
Web security / Vulnerability scanning
Actively updatedstars16,213Last update 2026-11-16
Read the ZAP review