HTTP Interesting File Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/files_dir metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: HTTP Interesting File Scanner
Module: auxiliary/scanner/http/files_dir
Source code: modules/auxiliary/scanner/http/files_dir.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 interesting files in a given directory path.
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/files_dir
msf auxiliary(files_dir) > show options
... show and set options ...
msf auxiliary(files_dir) > set RHOSTS ip-range
msf auxiliary(files_dir) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(files_dir) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(files_dir) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(files_dir) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Description
This module identifies the existence of interesting files in a given directory path.
Verification Steps
- Do:
use auxiliary/scanner/http/files_dir
- Do:
set RHOSTS [IP]
- Do:
set RPORT [PORT]
- Do:
run
Scenarios
Running the scanner
msf > use auxiliary/scanner/http/files_dir
msf auxiliary(files_dir) > show options
Module options (auxiliary/scanner/http/files_dir):
Name Current Setting Required Description
---- --------------- -------- -----------
DICTIONARY /root/Framework/msf/metasploit-framework/data/wmap/wmap_files.txt no Path of word dictionary to use
EXT no Append file extension to use
PATH / yes The path to identify files
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target address range or CIDR identifier
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads
VHOST no HTTP server virtual host
msf auxiliary(files_dir) > set RHOSTS 192.168.0.155
RHOSTS => 192.168.0.155
msf auxiliary(files_dir) > run
[*] Using code '404' as not found for files with extension .null
[*] Using code '404' as not found for files with extension .backup
[*] Using code '404' as not found for files with extension .bak
[*] Using code '404' as not found for files with extension .c
[*] Using code '404' as not found for files with extension .cfg
[*] Using code '404' as not found for files with extension .class
[*] Using code '404' as not found for files with extension .copy
[*] Using code '404' as not found for files with extension .conf
[*] Using code '404' as not found for files with extension .exe
[*] Using code '404' as not found for files with extension .html
[*] Found http://192.168.0.155:80/index.html 200
[*] Using code '404' as not found for files with extension .htm
[*] Using code '404' as not found for files with extension .ini
[*] Using code '404' as not found for files with extension .log
[*] Using code '404' as not found for files with extension .old
[*] Using code '404' as not found for files with extension .orig
[*] Using code '404' as not found for files with extension .php
[*] Using code '404' as not found for files with extension .tar
[*] Using code '404' as not found for files with extension .tar.gz
[*] Using code '404' as not found for files with extension .tgz
[*] Using code '404' as not found for files with extension .tmp
[*] Using code '404' as not found for files with extension .temp
[*] Using code '404' as not found for files with extension .txt
[*] Using code '404' as not found for files with extension .zip
[*] Using code '404' as not found for files with extension ~
[*] Using code '404' as not found for files with extension
[*] Found http://192.168.0.155:80/blog 301
[*] Found http://192.168.0.155:80/index 200
[*] Using code '404' as not found for files with extension
[*] Found http://192.168.0.155:80/blog 301
[*] Found http://192.168.0.155:80/index 200
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(files_dir) >
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/files_dir auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/files_dir
msf6 auxiliary(scanner/http/files_dir) > show info
Name: HTTP Interesting File Scanner
Module: auxiliary/scanner/http/files_dir
License: BSD License
Rank: Normal
Provided by:
et <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
DICTIONARY /opt/metasploit-framework/embedded/framework/data/wmap/wmap_files.txt no Path of word dictionary to use
EXT no Append file extension to use
PATH / yes The path to identify files
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 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module identifies the existence of interesting files in a given
directory path.
Module Options
This is a complete list of options available in the scanner/http/files_dir auxiliary module:
msf6 auxiliary(scanner/http/files_dir) > show options
Module options (auxiliary/scanner/http/files_dir):
Name Current Setting Required Description
---- --------------- -------- -----------
DICTIONARY /opt/metasploit-framework/embedded/framework/data/wmap/wmap_files.txt no Path of word dictionary to use
EXT no Append file extension to use
PATH / yes The path to identify files
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 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/files_dir auxiliary module:
msf6 auxiliary(scanner/http/files_dir) > show advanced
Module advanced options (auxiliary/scanner/http/files_dir):
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
ErrorCode 404 yes The expected http code for non existant files
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HTTP404Sigs /opt/metasploit-framework/embedded/framework/data/wmap/wmap_404s.txt no Path of 404 signatures to use
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
TestThreads 25 yes Number of test threads
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/files_dir module can do:
msf6 auxiliary(scanner/http/files_dir) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/files_dir auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/files_dir) > 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.
ErrorCode
Here is a relevant code snippet related to the "ErrorCode" error message:
31: )
32: ])
33:
34: register_advanced_options(
35: [
36: OptInt.new('ErrorCode', [ true, "The expected http code for non existant files", 404]),
37: OptPath.new('HTTP404Sigs', [ false, "Path of 404 signatures to use",
38: File.join(Msf::Config.data_directory, "wmap", "wmap_404s.txt")
39: ]
40: ),
41: OptBool.new('NoDetailMessages', [ false, "Do not display detailed test messages", true ]),
ErrorCode
Here is a relevant code snippet related to the "ErrorCode" error message:
97: end
98:
99: #
100: # Detect error code
101: #
102: ecode = datastore['ErrorCode'].to_i
103: begin
104: randfile = Rex::Text.rand_text_alpha(5).chomp
105:
106: res = send_request_cgi({
107: 'uri' => tpath+randfile+ext,
Using code '<ECODE>' as not found for files with extension <EXT>
Here is a relevant code snippet related to the "Using code '<ECODE>' as not found for files with extension <EXT>" error message:
128: else
129: print_status("Using custom 404 string of '#{emesg}'")
130: end
131: else
132: ecode = tcode
133: print_status("Using code '#{ecode}' as not found for files with extension #{ext}")
134: end
135:
136: rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
137: conn = false
138: rescue ::Timeout::Error, ::Errno::EPIPE
NOT Found <WMAP_BASE_URL><TPATH><TESTFEXT> <RES.CODE.TO_I>
Here is a relevant code snippet related to the "NOT Found <WMAP_BASE_URL><TPATH><TESTFEXT> <RES.CODE.TO_I>" error message:
152: 'ctype' => 'text/plain'
153: }, 20)
154:
155: if(not res or ((res.code.to_i == ecode) or (emesg and res.body.index(emesg))))
156: if dm == false
157: print_status("NOT Found #{wmap_base_url}#{tpath}#{testfext} #{res.code.to_i}")
158: end
159: else
160: if res.code.to_i == 400 and ecode != 400
161: print_error("Server returned an error code. #{wmap_base_url}#{tpath}#{testfext} #{res.code.to_i}")
162: else
Server returned an error code. <WMAP_BASE_URL><TPATH><TESTFEXT> <RES.CODE.TO_I>
Here is a relevant code snippet related to the "Server returned an error code. <WMAP_BASE_URL><TPATH><TESTFEXT> <RES.CODE.TO_I>" error message:
156: if dm == false
157: print_status("NOT Found #{wmap_base_url}#{tpath}#{testfext} #{res.code.to_i}")
158: end
159: else
160: if res.code.to_i == 400 and ecode != 400
161: print_error("Server returned an error code. #{wmap_base_url}#{tpath}#{testfext} #{res.code.to_i}")
162: else
163: print_good("Found #{wmap_base_url}#{tpath}#{testfext} #{res.code.to_i}")
164:
165: report_web_vuln(
166: :host => ip,
Go back to menu.
Related Pull Requests
- #14696 Merged Pull Request: Zeitwerk rex folder
- #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
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5059 Merged Pull Request: Yard doc corrections
- #2525 Merged Pull Request: Change module boilerplate
- #2426 Merged Pull Request: Find and replace Msf::Config.install_root, "data"
- #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/dos/misc/ibm_sametime_webplayer_dos
- auxiliary/gather/ibm_sametime_enumerate_users
- auxiliary/gather/ibm_sametime_room_brute
- auxiliary/gather/ibm_sametime_version
- auxiliary/scanner/http/prev_dir_same_name_file
- exploit/linux/local/sudo_baron_samedit
- exploit/windows/browser/ms12_037_same_id
- exploit/windows/lotus/domino_sametime_stmux
- auxiliary/gather/ie_sandbox_findfiles
- auxiliary/scanner/sap/sap_mgmt_con_getlogfiles
- auxiliary/scanner/sap/sap_mgmt_con_listconfigfiles
- auxiliary/scanner/sap/sap_mgmt_con_listlogfiles
- auxiliary/scanner/http/file_same_name_dir
- auxiliary/scanner/printer/printer_list_dir
- auxiliary/scanner/sap/sap_soap_rfc_rzl_read_dir
- exploit/linux/http/rconfig_ajaxarchivefiles_rce
- exploit/multi/http/hp_sitescope_uploadfileshandler
- exploit/windows/browser/hp_loadrunner_writefilestring
- exploit/windows/browser/imgeviewer_tifmergemultifiles
- exploit/windows/ftp/easyfilesharing_pass
- exploit/windows/http/easyfilesharing_post
- exploit/windows/http/easyfilesharing_seh
- exploit/windows/local/bypassuac_windows_store_filesys
- post/multi/manage/fileshare
- post/windows/gather/enum_files
- post/windows/gather/forensics/recovery_files
Authors
- et
Version
This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.