HTTP Error Based SQL Injection Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/error_sql_injection metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: HTTP Error Based SQL Injection Scanner
Module: auxiliary/scanner/http/error_sql_injection
Source code: modules/auxiliary/scanner/http/error_sql_injection.rb
Disclosure date: -
Last modification time: 2021-01-28 10:35:25 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -
This module identifies the existence of Error Based SQL injection issues. Still requires a lot of work
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/http/error_sql_injection
msf auxiliary(error_sql_injection) > show options
... show and set options ...
msf auxiliary(error_sql_injection) > set RHOSTS ip-range
msf auxiliary(error_sql_injection) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(error_sql_injection) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(error_sql_injection) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(error_sql_injection) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/error_sql_injection auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/error_sql_injection
msf6 auxiliary(scanner/http/error_sql_injection) > show info
Name: HTTP Error Based SQL Injection Scanner
Module: auxiliary/scanner/http/error_sql_injection
License: BSD License
Rank: Normal
Provided by:
et <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
DATA no HTTP Body/Data Query
METHOD GET yes HTTP Request Method (Accepted: GET, POST)
PATH /default.aspx yes The path/file to test SQL injection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
QUERY no HTTP URI Query
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module identifies the existence of Error Based SQL injection
issues. Still requires a lot of work
Module Options
This is a complete list of options available in the scanner/http/error_sql_injection auxiliary module:
msf6 auxiliary(scanner/http/error_sql_injection) > show options
Module options (auxiliary/scanner/http/error_sql_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
DATA no HTTP Body/Data Query
METHOD GET yes HTTP Request Method (Accepted: GET, POST)
PATH /default.aspx yes The path/file to test SQL injection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
QUERY no HTTP URI Query
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/error_sql_injection auxiliary module:
msf6 auxiliary(scanner/http/error_sql_injection) > show advanced
Module advanced options (auxiliary/scanner/http/error_sql_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
NoDetailMessages true no Do not display detailed test messages
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/error_sql_injection module can do:
msf6 auxiliary(scanner/http/error_sql_injection) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/error_sql_injection auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/error_sql_injection) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
Go back to menu.
Error Messages
This module may fail with the following error messages:
- HTTP Error Based SQL Injection Scanner
- Syntax error in string in query expression
- You have an error in your SQL syntax
- Syntax error
- You need to set QUERY param for GET
- You need to set DATA parameter for POST
- [<WMAP_TARGET_HOST>] Error string appears in the normal response, unable to test
- [<WMAP_TARGET_HOST>] Error string: '<INJE>'
- [<WMAP_TARGET_HOST>] DB TYPE: <DBT>, Error type '<INJT>'
- Error: <INJE>
- Database error
- Error string appears in the normal response <INJE> <DBT>
- Database error
- [<WMAP_TARGET_HOST>] No response
- [<WMAP_TARGET_HOST>] Error string: '<INJE>' Test Value: <QVARS:KEY>
- [<WMAP_TARGET_HOST>] Vuln query parameter: <KEY> DB TYPE: <DBT>, Error type '<INJT>'
- Error string appears in the normal response <INJE> <DBT>
- [<WMAP_TARGET_HOST>] No response
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
HTTP Error Based SQL Injection Scanner
Here is a relevant code snippet related to the "HTTP Error Based SQL Injection Scanner" error message:
12: include Msf::Auxiliary::Report
13:
14:
15: def initialize(info = {})
16: super(update_info(info,
17: 'Name' => 'HTTP Error Based SQL Injection Scanner',
18: 'Description' => %q{
19: This module identifies the existence of Error Based SQL injection issues. Still requires a lot of work
20:
21: },
22: 'Author' => [ 'et [at] cyberspace.org' ],
Syntax error in string in query expression
Here is a relevant code snippet related to the "Syntax error in string in query expression" error message:
57: [ "#{rand(10)}'", 'Random value with single quote']
58: ]
59:
60: errorstr = [
61: ["Unclosed quotation mark after the character string",'MSSQL','string'],
62: ["Syntax error in string in query expression",'MSSQL','string'],
63: ["Microsoft OLE DB Provider",'MSSQL','unknown'],
64: ["You have an error in your SQL syntax",'MySQL','unknown'],
65: ["java.sql.SQLException",'unknown','unknown'],
66: ["ORA-",'ORACLE','unknown'],
67: ["PLS-",'ORACLE','unknown'],
You have an error in your SQL syntax
Here is a relevant code snippet related to the "You have an error in your SQL syntax" error message:
59:
60: errorstr = [
61: ["Unclosed quotation mark after the character string",'MSSQL','string'],
62: ["Syntax error in string in query expression",'MSSQL','string'],
63: ["Microsoft OLE DB Provider",'MSSQL','unknown'],
64: ["You have an error in your SQL syntax",'MySQL','unknown'],
65: ["java.sql.SQLException",'unknown','unknown'],
66: ["ORA-",'ORACLE','unknown'],
67: ["PLS-",'ORACLE','unknown'],
68: ["Syntax error",'unknown','unknown'],
69: ]
Syntax error
Here is a relevant code snippet related to the "Syntax error" error message:
63: ["Microsoft OLE DB Provider",'MSSQL','unknown'],
64: ["You have an error in your SQL syntax",'MySQL','unknown'],
65: ["java.sql.SQLException",'unknown','unknown'],
66: ["ORA-",'ORACLE','unknown'],
67: ["PLS-",'ORACLE','unknown'],
68: ["Syntax error",'unknown','unknown'],
69: ]
70:
71: #
72: # Dealing with empty query/data and making them hashes.
73: #
You need to set QUERY param for GET
Here is a relevant code snippet related to the "You need to set QUERY param for GET" error message:
74:
75: if http_method =='GET'
76: if not datastore['QUERY'].empty?
77: qvars = queryparse(datastore['QUERY']) #Now its a Hash
78: else
79: print_error("You need to set QUERY param for GET")
80: return
81: end
82: else
83: if not datastore['DATA'].empty?
84: qvars = queryparse(datastore['DATA']) #Now its a Hash
You need to set DATA parameter for POST
Here is a relevant code snippet related to the "You need to set DATA parameter for POST" error message:
81: end
82: else
83: if not datastore['DATA'].empty?
84: qvars = queryparse(datastore['DATA']) #Now its a Hash
85: else
86: print_error("You need to set DATA parameter for POST")
87: return
88: end
89: end
90:
91: #
[<WMAP_TARGET_HOST>] Error string appears in the normal response, unable to test
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] Error string appears in the normal response, unable to test" error message:
138: injt = injtype
139: end
140: end
141:
142: if found
143: print_error("[#{wmap_target_host}] Error string appears in the normal response, unable to test")
144: print_error("[#{wmap_target_host}] Error string: '#{inje}'")
145: print_error("[#{wmap_target_host}] DB TYPE: #{dbt}, Error type '#{injt}'")
146:
147: report_web_vuln(
148: :host => ip,
[<WMAP_TARGET_HOST>] Error string: '<INJE>'
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] Error string: '<INJE>'" error message:
139: end
140: end
141:
142: if found
143: print_error("[#{wmap_target_host}] Error string appears in the normal response, unable to test")
144: print_error("[#{wmap_target_host}] Error string: '#{inje}'")
145: print_error("[#{wmap_target_host}] DB TYPE: #{dbt}, Error type '#{injt}'")
146:
147: report_web_vuln(
148: :host => ip,
149: :port => rport,
[<WMAP_TARGET_HOST>] DB TYPE: <DBT>, Error type '<INJT>'
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] DB TYPE: <DBT>, Error type '<INJT>'" error message:
140: end
141:
142: if found
143: print_error("[#{wmap_target_host}] Error string appears in the normal response, unable to test")
144: print_error("[#{wmap_target_host}] Error string: '#{inje}'")
145: print_error("[#{wmap_target_host}] DB TYPE: #{dbt}, Error type '#{injt}'")
146:
147: report_web_vuln(
148: :host => ip,
149: :port => rport,
150: :vhost => vhost,
Error: <INJE>
Here is a relevant code snippet related to the "Error: <INJE>" error message:
150: :vhost => vhost,
151: :ssl => ssl,
152: :path => datastore['PATH'],
153: :method => datastore['METHOD'],
154: :pname => "",
155: :proof => "Error: #{inje}",
156: :risk => 2,
157: :confidence => 50,
158: :category => 'Database error',
159: :description => "Error string appears in the normal response #{inje} #{dbt}",
160: :name => 'Database error'
Database error
Here is a relevant code snippet related to the "Database error" error message:
153: :method => datastore['METHOD'],
154: :pname => "",
155: :proof => "Error: #{inje}",
156: :risk => 2,
157: :confidence => 50,
158: :category => 'Database error',
159: :description => "Error string appears in the normal response #{inje} #{dbt}",
160: :name => 'Database error'
161: )
162:
163: return
Error string appears in the normal response <INJE> <DBT>
Here is a relevant code snippet related to the "Error string appears in the normal response <INJE> <DBT>" error message:
154: :pname => "",
155: :proof => "Error: #{inje}",
156: :risk => 2,
157: :confidence => 50,
158: :category => 'Database error',
159: :description => "Error string appears in the normal response #{inje} #{dbt}",
160: :name => 'Database error'
161: )
162:
163: return
164: end
Database error
Here is a relevant code snippet related to the "Database error" error message:
155: :proof => "Error: #{inje}",
156: :risk => 2,
157: :confidence => 50,
158: :category => 'Database error',
159: :description => "Error string appears in the normal response #{inje} #{dbt}",
160: :name => 'Database error'
161: )
162:
163: return
164: end
165: else
[<WMAP_TARGET_HOST>] No response
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] No response" error message:
161: )
162:
163: return
164: end
165: else
166: print_error("[#{wmap_target_host}] No response")
167: return
168: end
169:
170: #
171: # Test URI Query parameters
[<WMAP_TARGET_HOST>] Error string: '<INJE>' Test Value: <QVARS:KEY>
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] Error string: '<INJE>' Test Value: <QVARS:KEY>" error message:
234: end
235: end
236:
237: if found
238: print_good("[#{wmap_target_host}] SQL Injection found. (#{idesc}) (#{datastore['PATH']})")
239: print_good("[#{wmap_target_host}] Error string: '#{inje}' Test Value: #{qvars[key]}")
240: print_good("[#{wmap_target_host}] Vuln query parameter: #{key} DB TYPE: #{dbt}, Error type '#{injt}'")
241:
242: report_web_vuln(
243: :host => ip,
244: :port => rport,
[<WMAP_TARGET_HOST>] Vuln query parameter: <KEY> DB TYPE: <DBT>, Error type '<INJT>'
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] Vuln query parameter: <KEY> DB TYPE: <DBT>, Error type '<INJT>'" error message:
235: end
236:
237: if found
238: print_good("[#{wmap_target_host}] SQL Injection found. (#{idesc}) (#{datastore['PATH']})")
239: print_good("[#{wmap_target_host}] Error string: '#{inje}' Test Value: #{qvars[key]}")
240: print_good("[#{wmap_target_host}] Vuln query parameter: #{key} DB TYPE: #{dbt}, Error type '#{injt}'")
241:
242: report_web_vuln(
243: :host => ip,
244: :port => rport,
245: :vhost => vhost,
Error string appears in the normal response <INJE> <DBT>
Here is a relevant code snippet related to the "Error string appears in the normal response <INJE> <DBT>" error message:
249: :pname => key,
250: :proof => istr,
251: :risk => 2,
252: :confidence => 50,
253: :category => 'SQL injection',
254: :description => "Error string appears in the normal response #{inje} #{dbt}",
255: :name => 'SQL injection'
256: )
257:
258: return
259: end
[<WMAP_TARGET_HOST>] No response
Here is a relevant code snippet related to the "[<WMAP_TARGET_HOST>] No response" error message:
256: )
257:
258: return
259: end
260: else
261: print_error("[#{wmap_target_host}] No response")
262: return
263: end
264: end
265: end
266:
Go back to menu.
Related Pull Requests
- #14696 Merged Pull Request: Zeitwerk rex folder
- #8888 Merged Pull Request: spelling/grammar fixes part 1
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #7692 Merged Pull Request: Fixed issues #7691, silent exit.
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #2525 Merged Pull Request: Change module boilerplate
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
- #1047 Merged Pull Request: Set normalize uri on modules
Go back to menu.
See Also
Check also the following modules related to this module:
- auxiliary/admin/http/wp_symposium_sql_injection
- auxiliary/gather/ie_uxss_injection
- auxiliary/scanner/http/host_header_injection
- auxiliary/scanner/http/wordpress_content_injection
- auxiliary/scanner/postgres/postgres_dbname_flag_injection
- exploit/windows/fileformat/erdas_er_viewer_rf_report_error
- exploit/windows/tftp/opentftp_error_code
- auxiliary/scanner/http/blind_sql_query
- auxiliary/scanner/http/joomla_ecommercewd_sqli_scanner
- auxiliary/scanner/http/joomla_gallerywd_sqli_scanner
- auxiliary/scanner/http/vicidial_multiple_sqli
- auxiliary/scanner/http/wordpress_cp_calendar_sqli
- auxiliary/scanner/http/wp_abandoned_cart_sqli
- auxiliary/scanner/http/wp_chopslider_id_sqli
- auxiliary/scanner/http/wp_contus_video_gallery_sqli
- auxiliary/scanner/http/wp_email_sub_news_sqli
- auxiliary/scanner/http/wp_learnpress_sqli
- auxiliary/scanner/http/wp_loginizer_log_sqli
- auxiliary/scanner/http/wp_modern_events_calendar_sqli
- auxiliary/scanner/http/wp_registrationmagic_sqli
- auxiliary/scanner/http/wp_secure_copy_content_protection_sqli
- auxiliary/scanner/mssql/mssql_hashdump
- auxiliary/scanner/mssql/mssql_login
- auxiliary/scanner/mssql/mssql_ping
- auxiliary/scanner/mssql/mssql_schemadump
- auxiliary/scanner/mysql/mysql_authbypass_hashdump
- auxiliary/scanner/mysql/mysql_file_enum
- auxiliary/scanner/mysql/mysql_hashdump
- auxiliary/scanner/mysql/mysql_login
- auxiliary/scanner/mysql/mysql_schemadump
- auxiliary/scanner/mysql/mysql_version
- auxiliary/scanner/mysql/mysql_writable_dirs
- auxiliary/scanner/oracle/isqlplus_login
- auxiliary/scanner/oracle/isqlplus_sidbrute
Authors
- et [at] cyberspace.org
Version
This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.