Script http-sql-injection

Script types: portrule
Categories: intrusive, vuln

Script Summary

Spiders an HTTP server looking for URLs containing queries vulnerable to an SQL injection attack. It also extracts forms from found websites and tries to identify fields that are vulnerable.

The script spiders an HTTP server looking for URLs containing queries. It then proceeds to combine crafted SQL commands with susceptible URLs in order to obtain errors. The errors are analysed to see if the URL is vulnerable to attack. This uses the most basic form of SQL injection but anything more complicated is better suited to a standalone tool.

We may not have access to the target web server's true hostname, which can prevent access to virtually hosted sites.

See also:

Script Arguments


only spider URLs within the same host. (default: true)


a path to a file containing the error strings to search for (one per line, lines started with # are treated as comments). The default file is nselib/data/http-sql-errors.lst which was taken from fuzzdb project, for more info, see If someone detects some strings in that file causing a lot of false positives, then please report them to


only spider URLs within the same domain. This widens the scope from withinhost and can not be used in combination. (default: false)


the url to start spidering. This is a URL relative to the scanned host eg. /default.html (default: /)


the maximum amount of pages to visit. A negative value disables the limit (default: 20)


See the documentation for the slaxml library.

httpspider.doscraping, httpspider.maxdepth, httpspider.maxpagecount, httpspider.noblacklist, httpspider.url, httpspider.useheadfornonwebfiles, httpspider.withindomain, httpspider.withinhost

See the documentation for the httpspider library.

smbdomain, smbhash, smbnoguest, smbpassword, smbtype, smbusername

See the documentation for the smbauth library., http.max-body-size, http.max-cache-size, http.max-pipeline, http.pipeline, http.truncated-ok, http.useragent

See the documentation for the http library.

Example Usage

nmap -sV --script=http-sql-injection <target>

Script Output

80/tcp open  http    syn-ack
| http-sql-injection:
|   Possible sqli for queries:
|   Possible sqli for forms:
|     Form at path: /forms/f1.html, form's action: a1/check1.php. Fields that might be vulnerable:
|       f1text
|     Form at path: /forms/a1/../f2.html, form's action: a1/check2.php. Fields that might be vulnerable:
|_      f2text



  • Eddie Bell
  • Piotr Olma

License: Same as Nmap--See


portrule (host, port)



See also: