Microsoft IIS shortname vulnerability scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/iis_shortname_scanner metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Microsoft IIS shortname vulnerability scanner
Module: auxiliary/scanner/http/iis_shortname_scanner
Source code: modules/auxiliary/scanner/http/iis_shortname_scanner.rb
Disclosure date: -
Last modification time: 2019-10-03 12:28:54 +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: -
The vulnerability is caused by a tilde character "~" in a GET or OPTIONS request, which could allow remote attackers to disclose 8.3 filenames (short names). In 2010, Soroush Dalili and Ali Abbasnejad discovered the original bug (GET request). This was publicly disclosed in 2012. In 2014, Soroush Dalili discovered that newer IIS installations are vulnerable with OPTIONS.
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
msf > use auxiliary/scanner/http/iis_shortname_scanner
msf auxiliary(iis_shortname_scanner) > show targets
... a list of targets ...
msf auxiliary(iis_shortname_scanner) > set TARGET target-id
msf auxiliary(iis_shortname_scanner) > show options
... show and set options ...
msf auxiliary(iis_shortname_scanner) > exploit
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
The vulnerability is caused by a tilde character ~
in a GET or OPTIONS request, which could allow remote attackers
to disclose 8.3 filenames (short names). In 2010, Soroush Dalili and Ali Abbasnejad discovered the original bug (GET request)
this was publicly disclosed in 2012. In 2014, Soroush Dalili discovered that newer IIS installations are vulnerable with OPTIONS.
Older Microsoft IIS installations are vulnerable with GET, newer installations with OPTIONS
Remediation
Create registry key NtfsDisable8dot3NameCreation
at HKLM\SYSTEM\CurrentControlSet\Control\FileSystem
, with a value of 1
Verification Steps
- Install IIS (default installations are vulnerable)
- Start msfconsole
- Check:
msf > use auxiliary/scanner/http/iis_shortname_scanner
msf auxiliary(iis_shortname_scanner) > set 172.16.249.128
msf auxiliary(iis_shortname_scanner) > check
[+] 172.16.249.128:80 The target is vulnerable.
- Scan:
msf auxiliary(iis_shortname_scanner) > run
[*] Scanning in progress...
[+] Directories found
http://172.16.249.128/aspnet~1
http://172.16.249.128/secret~1
[+] Files found
http://172.16.249.128/web~1.con
http://172.16.249.128/index~1.htm
http://172.16.249.128/upload~1.asp
http://172.16.249.128/upload~2.asp
[*] Auxiliary module execution completed
Options
Module options (auxiliary/scanner/http/iis_shortname_scanner):
Name Current Setting Required Description
---- --------------- -------- -----------
PATH / yes The base path to start scanning from
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOST yes The target address
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
VHOST no HTTP server virtual host
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/iis_shortname_scanner auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/iis_shortname_scanner
msf6 auxiliary(scanner/http/iis_shortname_scanner) > show info
Name: Microsoft IIS shortname vulnerability scanner
Module: auxiliary/scanner/http/iis_shortname_scanner
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Soroush Dalili
Ali Abbasnejad
MinatoTW <[email protected]>
egre55 <[email protected]>
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PATH / yes The base path to start scanning from
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
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 20 yes Number of threads to use
VHOST no HTTP server virtual host
Description:
The vulnerability is caused by a tilde character "~" in a GET or
OPTIONS request, which could allow remote attackers to disclose 8.3
filenames (short names). In 2010, Soroush Dalili and Ali Abbasnejad
discovered the original bug (GET request). This was publicly
disclosed in 2012. In 2014, Soroush Dalili discovered that newer IIS
installations are vulnerable with OPTIONS.
References:
https://soroush.secproject.com/blog/tag/iis-tilde-vulnerability
https://support.detectify.com/customer/portal/articles/1711520-microsoft-iis-tilde-vulnerability
Module Options
This is a complete list of options available in the scanner/http/iis_shortname_scanner auxiliary module:
msf6 auxiliary(scanner/http/iis_shortname_scanner) > show options
Module options (auxiliary/scanner/http/iis_shortname_scanner):
Name Current Setting Required Description
---- --------------- -------- -----------
PATH / yes The base path to start scanning from
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
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 20 yes Number of threads to use
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/iis_shortname_scanner auxiliary module:
msf6 auxiliary(scanner/http/iis_shortname_scanner) > show advanced
Module advanced options (auxiliary/scanner/http/iis_shortname_scanner):
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
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)
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/iis_shortname_scanner module can do:
msf6 auxiliary(scanner/http/iis_shortname_scanner) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/iis_shortname_scanner auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/iis_shortname_scanner) > 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:
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.
Failed to connect to target
Here is a relevant code snippet related to the "Failed to connect to target" error message:
56: end
57:
58: def check
59: is_vul ? Exploit::CheckCode::Vulnerable : Exploit::CheckCode::Safe
60: rescue Rex::ConnectionError
61: print_bad("Failed to connect to target")
62: end
63:
64: def is_vul
65: @path = datastore['PATH']
66: for method in ['GET', 'OPTIONS']
Failed to connect to target
Here is a relevant code snippet related to the "Failed to connect to target" error message:
81: return true
82: end
83: end
84: return false
85: rescue Rex::ConnectionError
86: print_bad("Failed to connect to target")
87: end
88:
89: def get_status(f , digit , match)
90: # Get response code for a file/folder
91: res2 = send_request_cgi({
Unable to connect to <RHOST>
Here is a relevant code snippet related to the "Unable to connect to <RHOST>" error message:
92: 'uri' => normalize_uri(@path,"#{f}#{match}~#{digit}#{match}"),
93: 'method' => @verb
94: })
95: return res2.code
96: rescue NoMethodError
97: print_error("Unable to connect to #{datastore['RHOST']}")
98: end
99:
100: def get_incomplete_status(url, match, digit , ext)
101: # Check if the file/folder name is more than 6 by using wildcards
102: res2 = send_request_cgi({
Unable to connect to <RHOST>
Here is a relevant code snippet related to the "Unable to connect to <RHOST>" error message:
103: 'uri' => normalize_uri(@path,"#{url}#{match}~#{digit}.#{ext}*"),
104: 'method' => @verb
105: })
106: return res2.code
107: rescue NoMethodError
108: print_error("Unable to connect to #{datastore['RHOST']}")
109: end
110:
111: def get_complete_status(url, digit , ext)
112: # Check if the file/folder name is less than 6 and complete
113: res2 = send_request_cgi({
Unable to connect to <RHOST>
Here is a relevant code snippet related to the "Unable to connect to <RHOST>" error message:
114: 'uri' => normalize_uri(@path,"#{url}*~#{digit}.#{ext}"),
115: 'method' => @verb
116: })
117: return res2.code
118: rescue NoMethodError
119: print_error("Unable to connect to #{datastore['RHOST']}")
120: end
121:
122: def scanner
123: while !@queue_ext.empty?
124: f = @queue_ext.pop
Target is not vulnerable, or no shortname scannable files are present.
Here is a relevant code snippet related to the "Target is not vulnerable, or no shortname scannable files are present." error message:
221: end
222: end
223:
224: def run
225: unless is_vul
226: print_status("Target is not vulnerable, or no shortname scannable files are present.")
227: return
228: end
229: unless @path.end_with? '/'
230: @path += '/'
231: end
No directories were found
Here is a relevant code snippet related to the "No directories were found" error message:
248: @threads.each(&:join)
249:
250: proto = datastore['SSL'] ? 'https' : 'http'
251:
252: if @dirs.empty?
253: print_status("No directories were found")
254: else
255: print_good("Found #{@dirs.size} directories")
256: @dirs.each do |x|
257: print_good("#{proto}://#{datastore['RHOST']}#{@path}#{x}")
258: end
No files were found
Here is a relevant code snippet related to the "No files were found" error message:
257: print_good("#{proto}://#{datastore['RHOST']}#{@path}#{x}")
258: end
259: end
260:
261: if @files.empty?
262: print_status("No files were found")
263: else
264: print_good("Found #{@files.size} files")
265: @files.each do |x|
266: print_good("#{proto}://#{datastore['RHOST']}#{@path}#{x}")
267: end
Go back to menu.
Related Pull Requests
- #12392 Merged Pull Request: Spelling correction in iis_shortname_scanner.rb
- #12354 Merged Pull Request: Remove targets from aux and post modules
- #11460 Merged Pull Request: Changing print_line to print_good
- #11011 Merged Pull Request: iis_shortname fixes
- #10558 Merged Pull Request: Add IIS ShortName Scanner module
References
- CVE: Not available
- https://soroush.secproject.com/blog/tag/iis-tilde-vulnerability
- https://support.detectify.com/customer/portal/articles/1711520-microsoft-iis-tilde-vulnerability
See Also
Check also the following modules related to this module:
- auxiliary/scanner/http/iis_internal_ip
- auxiliary/admin/http/iis_auth_bypass
- auxiliary/dos/windows/ftp/iis_list_exhaustion
- exploit/windows/iis/iis_webdav_scstoragepathfromurl
- exploit/windows/iis/iis_webdav_upload_asp
- exploit/windows/iis/ms01_023_printer
- exploit/windows/iis/ms01_026_dbldecode
- exploit/windows/iis/ms01_033_idq
- exploit/windows/iis/ms02_018_htr
- exploit/windows/iis/ms02_065_msadc
- exploit/windows/iis/ms03_007_ntdll_webdav
- exploit/windows/iis/msadc
- auxiliary/dos/windows/ftp/iis75_ftpd_iac_bof
- auxiliary/scanner/http/owa_iis_internal_ip
- exploit/windows/isapi/ms03_022_nsiislog_post
Authors
- Soroush Dalili
- Ali Abbasnejad
- MinatoTW <shaks19jais[at]gmail.com>
- egre55 <ianaustin[at]protonmail.com>
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.