Sqlmap is an open source command-line automatic SQL injection tool. Its goal is to detect and take advantage of SQL injection vulnerabilities in web applications. Once it detects one or more SQL injections on the target host, the user can choose among a variety of options to perform an extensive back-end database management system fingerprint, retrieve DBMS session user and database, enumerate users, password hashes, privileges, databases, dump entire or user's specified DBMS tables/columns, run his own SQL statement, read or write either text or binary files on the file system, execute arbitrary commands on the operating system, establish an out-of-band stateful connection between the attacker box and the database server via Metasploit payload stager, database stored procedure buffer overflow exploitation or SMB relay attack and more.
Download
- Source gzip compressed operating system independent.
- Source bzip2 compressed operating system independent.
- Source zip compressed operating system independent.
- DEB binary package architecture independent for Debian and any other Debian derivated GNU/Linux distribution.
- RPM binary package architecture independent for Fedora and any other operating system that can install RPM packages.
- Portable executable for Windows that does not require the Python interpreter to be installed on the operating system.
$ svn checkout https://svn.sqlmap.org/sqlmap/trunk/sqlmap sqlmap-dev
sqlmap features
Generic features
- Full support for MySQL, Oracle, PostgreSQL and Microsoft SQL Server back-end database management systems. Besides these four database management systems software, sqlmap can also identify Microsoft Access, DB2, Informix, Sybase and Interbase.
- Full support for three SQL injection techniques: inferential blind SQL injection, UNION query (inband) SQL injection and batched queries support. sqlmap can also test for time based blind SQL injection.
- It is possible to provide a single target URL, get the list of targets from Burp proxy requests log file or WebScarab proxy
conversations/
folder, get the whole HTTP request from a text file or get the list of targets by providing sqlmap with a Google dork which queries Google search engine and parses its results page. You can also define a regular-expression based scope that is used to identify which of the parsed addresses to test. - Automatically tests all provided GET parameters, POST parameters, HTTP Cookie header values and HTTP User-Agent header value to find the dynamic ones, which means those that vary the HTTP response page content. On the dynamic ones sqlmap automatically tests and detects the ones affected by SQL injection. Each dynamic parameter is tested for numeric, single quoted string,double quoted string and all of these three data-types with zero to two parenthesis to correctly detect which is the
SELECT
statement syntax to perform further injections with. It is also possible to specify the only parameter(s) that you want to perform tests and use for injection on. - Option to specify the maximum number of concurrent HTTP requests to speed up the inferential blind SQL injection algorithms (multi-threading). It is also possible to specify the number of seconds to wait between each HTTP request.
- HTTP
Cookie
header string support, useful when the web application requires authentication based upon cookies and you have such data or in case you just want to test for and exploit SQL injection on such header. You can also specify to always URL-encode the Cookie header. - Automatically handle HTTP
Set-Cookie
header from the application, re-establishing of the session if it expires. Test and exploit on these values is supported too. You can also force to ignore anySet-Cookie
header. - HTTP Basic, Digest, NTLM and Certificate authentications support.
- Anonymous HTTP proxy support to pass by the requests to the target application that works also with HTTPS requests.
- Options to fake the HTTP
Referer
header value and the HTTPUser-Agent
header value specified by user or randomly selected from a text file. - Support to increase the verbosity level of output messages: there exist six levels. The default level is 1 in which information, warnings, errors and tracebacks (if any occur) will be shown.
- Granularity in the user's options.
- Estimated time of arrival support for each query, updated in real time while fetching the information to give to the user an overview on how long it will take to retrieve the output.
- Automatic support to save the session (queries and their output, even if partially retrieved) in real time while fetching the data on a text file and resume the injection from this file in a second time.
- Support to read options from a configuration INI file rather than specify each time all of the options on the command line. Support also to save command line options on a configuration INI file.
- Option to update sqlmap as a whole to the latest development version from the Subversion repository.
- Integration with other IT security open source projects, Metasploit and w3af.
Fingerprint and enumeration features
- Extensive back-end database software version and underlying operating system fingerprint based upon inband error messages, banner parsing, functions output comparison and specific features such as MySQL comment injection. It is also possible to force the back-end database management system name if you already know it.
- Basic web server software and web application technology fingerprint.
- Support to retrieve the DBMS banner, session user and current database information. The tool can also check if the session user is a database administrator (DBA).
- Support to enumerate database users, users' password hashes, users' privileges, databases, tables and columns.
- Support to dump database tables as a whole or a range of entries as per user's choice. The user can also choose to dump only specific column(s).
- Support to automatically dump all databases' schemas and entries. It is possibly to exclude from the dump the system databases.
- Support to enumerate and dump all databases' tables containing user provided column(s). Useful to identify for instance tables containing custom application credentials.
- Support to run custom SQL statement(s) as in an interactive SQL client connecting to the back-end database. sqlmap automatically dissects the provided statement, determines which technique to use to inject it and how to pack the SQL payload accordingly.
Takeover features
- Support to inject custom user-defined functions: the user can compile shared object then use sqlmap to create within the back-end DBMS user-defined functions out of the compiled shared object file. These UDFs can then be executed, and optionally removed, via sqlmap too.
- Support to read and upload any file from the database server underlying file system when the database software is MySQL, PostgreSQL or Microsoft SQL Server.
- Support to execute arbitrary commands and retrieve their standard output on the database server underlying operating system when the database software is MySQL, PostgreSQL or Microsoft SQL Server.
- On MySQL and PostgreSQL via user-defined function injection and execution.
- On Microsoft SQL Server via
xp_cmdshell()
stored procedure. Also, the stored procedure is re-enabled if disabled or created from scratch if removed.
- Support to establish an out-of-band stateful TCP connection between the user machine and the database server underlying operating system. This channel can be an interactive command prompt, a Meterpreter session or a graphical user interface (VNC) session as per user's choice. sqlmap relies on Metasploit to create the shellcode and implements four different techniques to execute it on the database server. These techniques are:
- Database in-memory execution of the Metasploit's shellcode via sqlmap own user-defined function
sys_bineval()
. Supported on MySQL and PostgreSQL. - Upload and execution of a Metasploit's stand-alone payload stager via sqlmap own user-defined function
sys_exec()
on MySQL and PostgreSQL or viaxp_cmdshell()
on Microsoft SQL Server. - Execution of Metasploit's shellcode by performing a SMB reflection attack ( MS08-068) with a UNC path request from the database server to the user's machine where the Metasploit
smb_relay
server exploit runs. - Database in-memory execution of the Metasploit's shellcode by exploiting Microsoft SQL Server 2000 and 2005
sp_replwritetovarbin
stored procedure heap-based buffer overflow (MS09-004) with automatic DEP bypass.
- Database in-memory execution of the Metasploit's shellcode via sqlmap own user-defined function
- Support for database process' user privilege escalation via Metasploit's
getsystem
command which include, among others, the kitrap0d technique ( MS10-015) or via Windows Access Tokens kidnapping by using Meterpreter'sincognito
extension. - Support to access (read/add/delete) Windows registry hives.
No comments:
Post a Comment