SQLMap: Testing SQL Database Vulnerabilities
Original URL: https://blog.bughunt.com.br/sqlmap-vulnerabilidades-banco-de-dados/
Tags: 🛠️ Tool, 🌐 Web, 💉 SQLi
Technical Summary
SQL Injection: Critical Web Application
Vulnerability
SQL Injection remains one of the most critical web application vulnerabilities, allowing attackers to
manipulate database queries and exfiltrate data. Despite decades of awareness, many applications
still lack robust input validation and parameterization, leaving them vulnerable to SQLi attacks.
Tool Overview: SQLMap
SQLMap is a Python-based command-line tool that automates the detection and exploitation of SQL
Injection flaws. By specifying a target URL with dynamic parameters, e.g.
http://example.com/page.php?id=1 , SQLMap performs multiple injection techniques—Boolean-
based, time-based blind, and error-based—and parses HTTP responses to confirm vulnerability and
identify exploitable vectors.
Example Usage
sqlmap -u "http://example.com/page.php?id=1" --dbs
Enumeration Options
--tables -D <database_name> — List tables in a specific database
--columns -D <database_name> -T <table_name> — List columns in a specific table
--dump -D <database_name> -T <table_name> — Extract all data from a table
Supported DBMS and Advanced Features
Supported DBMS: MySQL, PostgreSQL, Oracle, SQLite, among others.
Advanced Features:
Custom HTTP headers: --headers "Header: value"
Session handling with cookies: --cookie "SESSION=abc"
Authenticated scans: --auth-type basic --auth-cred user:pass
Proxy integration for request/response debugging: --proxy http://127.0.0.1:8080
Logging and Reporting
All interactions are logged with detailed request/response pairs, facilitating forensic analysis. After
detection, SQLMap suggests technical steps for exploitation within controlled and authorized scopes.
Integration and Best Practices
Integrating SQLMap into CI/CD pipelines or periodic penetration tests ensures continuous scanning
and early detection of SQLi flaws, reinforcing a security-first mindset and preventing costly data
breaches.
Hacking Tricks Summary
Automated SQL Injection Scanning: SQLMap automates traditional SQLi testing by injecting
crafted payloads (Boolean-based, time-based blind, error-based) into dynamic parameters and
analyzing HTTP responses to accurately identify injectable vectors, removing manual trial-and-error.
Customized & Authenticated Payload Delivery: Through options like --headers , --cookie , and
--auth-cred , SQLMap can mimic legitimate user sessions, bypass access controls, and target
authenticated code paths, enabling injection tests in restricted contexts.
Automated Enumeration & Data Exfiltration: Upon exploitation, SQLMap uses commands such as
--dbs , --tables , --columns , and --dump to systematically enumerate DBMS objects and extract
data, transforming a single injection point into a full data extraction workflow.