sqlmap – SQL Injection Automation and Database Takeover Tool

Open-source penetration testing tool automating SQL injection detection and exploitation across 50+ database management systems with advanced data extraction.

About sqlmap

sqlmap is an open-source penetration testing tool automating SQL injection detection and exploitation across 50+ database management systems. Originally developed in 2006 by Bernardo Damele Assumpcao Guimaraes and later enhanced by Miroslav Stampar, sqlmap has become the industry standard for SQL injection assessment in professional security testing. The tool supports six distinct SQL injection techniques (boolean-based blind, time-based blind, error-based, UNION query-based, stacked queries, out-of-band) enabling exploitation even in difficult network conditions. Version 1.9 introduces enhanced database enumeration, improved command injection payloads, and better handling of WAF filters. Beyond vulnerability detection, sqlmap enables direct database connectivity, OS shell establishment, and file system access when database permissions allow, providing comprehensive post-exploitation capabilities.

System Requirements

  • Operating System: Windows 7 or later, Linux (Ubuntu 14.04 LTS+), macOS 10.9+, BSD systems
  • Processor: Any processor capable of running Python 2.7 or 3.x
  • RAM: 256 MB RAM
  • Disk Space: 100 MB disk space
  • Additional Requirements: Python 2.7+ or Python 3.x, Internet connection for database connectivity testing, optional: Metasploit for OS shell establishment

Features Of sqlmap

  • Automatic SQL injection detection and exploitation across 50+ database management systems
  • Six SQL injection exploitation techniques for comprehensive vulnerability testing
  • Database enumeration extracting users, password hashes, privileges, databases, tables, columns
  • Passworddict-based hash cracking with automatic hash format recognition
  • Direct database connectivity without SQL injection vulnerability
  • File system access and upload capabilities on vulnerable database servers
  • OS command execution with arbitrary command and output retrieval
  • Out-of-band stateful TCP connection establishment for data exfiltration
  • Database server privilege escalation via Metasploit integration
  • WAF filter detection and bypassing mechanisms
  • Customizable request headers and cookie handling for authenticated testing
  • Batch exploitation mode for automated parameter testing
  • Dump resume functionality for interrupted exploitation sessions

Pros & Cons

Pros

  • Completely free and open-source with no licensing restrictions on usage
  • Unmatched SQL injection testing specialization unavailable in general-purpose scanners
  • Supports 50+ database management systems covering enterprise and emerging DBMS
  • Minimal dependencies enabling deployment in restricted network environments
  • Comprehensive command-line interface suited for automation and CI/CD integration
  • Active development with regular updates addressing emerging SQL injection bypasses
  • Detailed user manual and comprehensive feature documentation
  • Capable of establishing OS shells and executing arbitrary commands post-exploitation
  • WAF bypass techniques enabling testing through web application firewalls
  • Password hash cracking built-in for identifying exposed credentials

Cons

  • Command-line only interface challenging for users preferring graphical workflow
  • Specialized in SQL injection only, lacking detection of other vulnerability types
  • Requires Python knowledge for custom payload development and scripting
  • Detection evasion and WAF bypass techniques require advanced technical understanding
  • Network connectivity testing may trigger security alerts on monitored networks
  • Limited output formatting options for some specialized reporting requirements
  • Community support only with no commercial backing or guaranteed response times

Changelog

Version 1.9 (January 2025):
- Enhanced database enumeration speed with optimized query techniques
- Improved WAF filter detection and bypassing mechanisms
- Better handling of stacked query injections in PostgreSQL
- Enhanced OS command execution payload generation
- Improved error-based injection detection accuracy
- Added support for new DBMS variants (ClickHouse, OpenGauss)
- Security improvements for payload obfuscation
- Better session resumption across exploitation attempts

Version 1.8 (Previous Release):
- Improved UNION query injection detection
- Enhanced out-of-band exploitation mechanisms
- Better database fingerprinting for newer DBMS versions
- Security patches for payload handling
- Improved performance in time-based blind injection

Version 1.7:
- Added support for additional database systems
- Enhanced file system access capabilities
- Improved privilege escalation techniques
- Better handling of encoded parameters

Frequently Asked Questions

What Python versions does sqlmap support?

sqlmap supports Python 2.6, 2.7, and Python 3.x on all platforms. Python 3.6+ is recommended for modern systems and latest vulnerability detection capabilities. Installation requires no external dependencies beyond Python standard library.

Can sqlmap test authenticated SQL injections?

Yes, sqlmap fully supports authenticated testing through multiple methods. Users can provide cookies using --cookie parameter, HTTP basic authentication with --auth-type and --auth-cred, or custom headers. This enables testing of SQL injections in protected application areas.

How does sqlmap bypass Web Application Firewalls?

sqlmap includes WAF detection and bypass techniques using tamper scripts that transform payloads to evade filters. Options include case modification, comment insertion, and encoding techniques. Users can develop custom tamper scripts for specific WAF configurations encountered during assessments.

What DBMS does sqlmap support?

sqlmap supports 50+ database management systems including MySQL, Oracle, PostgreSQL, SQL Server, Access, DB2, SQLite, MongoDB, and many others. Run sqlmap --list-dbms for complete list of supported databases.

Can sqlmap execute operating system commands?

Yes, when database permissions allow. sqlmap can execute arbitrary OS commands on MySQL, PostgreSQL, and MSSQL using database-specific functions like MySQL's sys_exec or PostgreSQL's os_execute. This requires database user privilege elevation.

How do I speed up sqlmap exploitation?

Increase thread count using --threads parameter (typical range 5-10). Select specific injection technique with --technique parameter prioritizing faster options. Use --fingerprint for automatic DBMS detection. Limit enumeration scope to specific databases and tables using --database and --table parameters.

Is sqlmap suitable for CI/CD integration?

Yes, sqlmap's command-line interface and batch processing capabilities enable CI/CD pipeline integration. Execute automated scans on application test URLs, capture output in structured formats, and fail builds on critical SQL injection vulnerabilities detected.