sqlmap on Parrot Linux: Testing Your Own Web App for SQL Injection

This tutorial is for authorized testing only: use sqlmap against your own web applications, a lab target you control, or a legal training platform like DVWA or an intentionally vulnerable Hack The Box box. Never point it at a site you do not own or have written permission to test.

SQL injection is still one of the most common web application flaws, and sqlmap on Parrot Linux is the fastest way to find out whether your own app leaks data through a vulnerable parameter. sqlmap automates the detection and exploitation of injection points, but the value for a defender is in understanding how a single unsanitised input can expose an entire database. This guide walks you through installing sqlmap, pointing it at a lab target, reading its output, and turning the findings into fixes.

What sqlmap does (and why you run it on your own app)

sqlmap is a command-line tool written in Python that tests URL parameters, POST data, cookies and headers for SQL injection. When it finds an injectable parameter it can enumerate databases, tables and columns, dump rows, read files and in some configurations get a shell on the database host. For a developer or self-hoster, the point is defensive: you confirm whether your input handling is broken before an attacker does, then you patch it with parameterised queries. Parrot Linux ships sqlmap in its Security Edition, so on a standard install you usually already have it.

Set up a safe lab target first

Do not practise on a live production site, even your own, until you understand the tool. The cleanest approach is a local vulnerable app. Damn Vulnerable Web Application (DVWA) is the classic choice and runs well in Docker. If you have not built a practice environment yet, the walkthrough in our home pentesting lab guide sets up DVWA and Metasploitable on an isolated network, and you will need Docker installed on Parrot Linux for the container route.

A quick DVWA container:

docker run --rm -it -p 127.0.0.1:8080:80 vulnerables/web-dvwa

Binding to 127.0.0.1 keeps the vulnerable app off your network. Log in to DVWA at http://127.0.0.1:8080, set the security level to low for your first run, and use the SQL Injection page.

Install and verify sqlmap on Parrot Linux

On the Security Edition sqlmap is preinstalled. If you are on the Home Edition or removed it, install from the Parrot repository:

sudo apt update
sudo apt install sqlmap

Confirm the version and that it launches:

sqlmap --version

If you want the very latest development build, you can also clone it from the project’s own repository, but the packaged version is fine for learning and gets security updates through apt and parrot-upgrade.

Your first scan against the lab

Grab the vulnerable URL from DVWA (it will look like a page that takes an id parameter). Because DVWA requires a session, you pass your cookie so sqlmap stays authenticated. The simplest detection run:

sqlmap -u "http://127.0.0.1:8080/vulnerabilities/sqli/?id=1&Submit=Submit" 
  --cookie="PHPSESSID=YOUR_SESSION; security=low" 
  --batch

What each part does:

  • -u is the target URL including the parameter you want tested.
  • --cookie carries your authenticated session so the request reaches the vulnerable page.
  • --batch accepts the default answer to every prompt, which keeps the run non-interactive.

sqlmap will report which parameter is injectable and the injection types it confirmed (boolean-based, error-based, time-based blind, UNION query). Seeing more than one technique succeed is normal on an unsanitised parameter.

Understanding the injection techniques sqlmap reports

The technique names in the output are not just trivia; they tell you how the data is leaking, which shapes your fix and your logging. A boolean-based blind injection means the app returns one response for a true condition and another for false, so sqlmap infers data one bit at a time by asking yes/no questions. Error-based injection means the database error messages are reaching the page and sqlmap reads data straight out of them, which also tells you verbose errors are exposed in production. Time-based blind injection relies on payloads that make the database sleep; sqlmap measures the delay to read data when there is no visible output at all. A UNION query injection means it can append its own SELECT to yours and pull columns directly, which is the fastest and loudest technique. When you later review your web server and database logs, these map to recognisable patterns: repeated near-identical requests for blind techniques, or obvious UNION SELECT strings for union-based.

Enumerating the database step by step

Once an injection point is confirmed, you walk down the structure rather than dumping everything blind. List the databases:

sqlmap -u "http://127.0.0.1:8080/vulnerabilities/sqli/?id=1&Submit=Submit" 
  --cookie="PHPSESSID=YOUR_SESSION; security=low" --batch --dbs

Pick one and list its tables:

sqlmap -u "..." --cookie="..." --batch -D dvwa --tables

Then the columns of a table, and finally the rows:

sqlmap -u "..." --cookie="..." --batch -D dvwa -T users --columns
sqlmap -u "..." --cookie="..." --batch -D dvwa -T users -C user,password --dump

In a real audit you would stop at proving the injection exists; you do not need to exfiltrate every row to demonstrate the risk. In your own lab, dumping the users table shows you exactly what an attacker would see, which is the lesson.

Common options you will actually use

OptionWhat it does
--level=1..5How many requests and injection points to test. Higher finds more, runs slower.
--risk=1..3How aggressive the payloads are. Risk 3 can modify data, so keep it low outside a throwaway lab.
--data="..."Test POST parameters instead of a query string.
--dbms=mysqlTell sqlmap the backend so it skips irrelevant payloads.
--tamper=...Apply evasion scripts; only relevant when testing your own WAF rules.
-r request.txtLoad a full raw HTTP request saved from your proxy.

The -r flag pairs naturally with an intercepting proxy. If you capture a request in Burp, save it to a file and feed it to sqlmap; our guide on Burp Suite on Parrot Linux covers that capture workflow.

Reading the results like a defender

When sqlmap confirms an injection, note three things: the parameter, the injection technique, and the backend DBMS it fingerprinted. That tells you where the unsafe query lives and how the input reached it. The fix is almost always the same regardless of technique: stop building SQL by concatenating user input, and switch to parameterised queries or prepared statements. Input validation and least-privilege database accounts are defence in depth, not the primary fix. After you patch, re-run the same sqlmap command; a properly parameterised query returns no injectable parameter, which is your confirmation.

When sqlmap finds nothing

A clean result is good news, but make sure it is real and not a configuration problem. If sqlmap reports no injectable parameter, check that your session cookie is still valid, that you targeted the right parameter, and that the request actually reached the vulnerable page rather than a login redirect. Raise --level and --risk a step on a lab target to rule out a missed edge case. If you are testing through a proxy and seeing connection errors, confirm the proxy is running and that you passed --proxy correctly. On your own hardened app, a genuine no-injection result after you switched to prepared statements is exactly what you want to see, and re-running after each code change gives you a simple regression check.

Keeping it legal and contained

Three rules keep this work on the right side of the line. Only test systems you own or have explicit written authorisation to test. Keep lab targets like DVWA bound to localhost or an isolated host-only network so they never become a liability on the wider internet. And treat any data you dump from your own lab as disposable, because the whole environment should be rebuildable from scratch. If you want to expand beyond web injection, the same contained-lab discipline applies to the tools in our CTF setup guide and to network scanning with Nmap on Parrot Linux.

FAQ

Is sqlmap preinstalled on Parrot Linux?

On the Security Edition, yes. On the Home Edition you install it with sudo apt install sqlmap, and it updates through the normal Parrot package channels.

Can I use sqlmap on any website to check if it is vulnerable?

No. Running sqlmap against a system you do not own or lack written permission to test is unauthorised access and is illegal in most jurisdictions. Stick to your own apps and lab targets.

What do I do after sqlmap finds an injection in my app?

Rewrite the affected query using parameterised statements or prepared statements so user input is never concatenated into SQL, then re-run sqlmap to confirm the parameter is no longer injectable.