HTTP Directory Brute Force Scanner - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/brute_dirs metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: HTTP Directory Brute Force Scanner
Module: auxiliary/scanner/http/brute_dirs
Source code: modules/auxiliary/scanner/http/brute_dirs.rb
Disclosure date: -
Last modification time: 2019-10-21 16:45:42 +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 directories by brute forcing the name 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/brute_dirs
msf auxiliary(brute_dirs) > show options
... show and set options ...
msf auxiliary(brute_dirs) > set RHOSTS ip-range
msf auxiliary(brute_dirs) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(brute_dirs) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(brute_dirs) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(brute_dirs) > 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
Vulnerable Application
Web sites & other HTTP based applications may be vulnerable to directory brute forcing. This module executes a directory brute force on a web server, in order to discover locations on the web server for further analysis. This is not the same as using a word dictionary - this module uses string permutations instead.
Install
Any web server that serves directories can be used. This module can support different authentication methods, which will depend on the type of web server used.
Verification Steps
- Start
msfconsole
- Do:
use auxiliary/scanner/http/brute_dirs
- Do:
set rhosts [IPs]
- Do:
run
- As the module executes you should see a list of directories that are being served up by the web server.
Options
DELAY
The delay between connections, per thread, in milliseconds. Using this will reduce the speed of the
module, which may be useful to prevent any rate limiting or web application firewalls from preventing further scanning.
Defaults to 0
.
FORMAT
The comma separated list of expected directory formats used to determine the order of brute
force attempts.
Defaults to a,aa,aaa
.
Use the following format specifiers:
Format specifier | Character type |
---|---|
a | lowercase alpha |
d | digit |
A | uppercase alpha |
The default value will search a,aa,aaa
will search for 1 character directories, then 2 character directories, then 3
character directories.
JITTER
The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds. Using jitter ensures
requests have a random amount of additional delay. This is also useful for evading brute force prevention.
Defaults to 0
.
PATH
The path to starting identification of directories from.
Defaults to /
.
THREADS
The number of concurrent threads (max one per host).
Defaults to 1
.
TIMEOUT
The socket connect/read timeout in seconds.
Defaults to 20
.
ErrorCode
The expected HTTP code for non existent directories.
Defaults to 404
.
HTTP404Sigs
Path of 404 signatures to use to identify 'file not found' strings
in website output, even if a successful HTTP Status Code is returned by the server.
Defaults to [Metasploit data directory]/wmap/wmap_404s.txt
.
Scenarios
HTTP directory brute force on a specific port
Identify an open HTTP port on a target web server by using nmap
:
nmap -p8080 192.168.2.3
.
.
.
PORT STATE SERVICE
8080/tcp open http
Configure the brute_dirs
module to use the identified IP address and port number:
msf5 > use auxiliary/scanner/http/brute_dirs
msf5 auxiliary(scanner/http/brute_dirs) > set RHOSTS 192.168.2.3
msf5 auxiliary(scanner/http/brute_dirs) > set RPORT 8080
RHOSTS => 192.168.2.3
msf5 auxiliary(scanner/http/brute_dirs) > run
[*] Using code '404' as not found.
[+] Found http://192.168.2.3:8080/dav/ 200
[+] Found http://192.168.2.3:8080/img/ 200
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Testing against multiple hosts using a CIDR
msf5 > use auxiliary/scanner/http/brute_dirs
msf5 auxiliary(scanner/http/brute_dirs) > show options
... show and set options ...
msf5 auxiliary(scanner/http/brute_dirs) > set RHOSTS 192.168.2.1/24
msf5 auxiliary(scanner/http/brute_dirs) > run
Custom format to find specifically formatted directories
A format string of Aaaaad
will search for 6 character directories, starting with a capital letter and ending in a
digit. E.g.
msf5 > use auxiliary/scanner/http/brute_dirs
msf5 auxiliary(scanner/http/brute_dirs) > set RHOSTS 192.168.2.3
msf5 auxiliary(scanner/http/brute_dirs) > set FORMAT 'Aaaaad'
msf5 auxiliary(scanner/http/brute_dirs) > run
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/brute_dirs auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/brute_dirs
msf6 auxiliary(scanner/http/brute_dirs) > show info
Name: HTTP Directory Brute Force Scanner
Module: auxiliary/scanner/http/brute_dirs
License: BSD License
Rank: Normal
Provided by:
et <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
DELAY 0 yes The delay between connections, per thread, in milliseconds
FORMAT a,aa,aaa yes The expected directory format (a alpha, d digit, A upperalpha)
JITTER 0 yes The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds.
PATH / yes The path to identify directories
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)
TIMEOUT 20 yes The socket connect/read timeout in seconds
VHOST no HTTP server virtual host
Description:
This module identifies the existence of interesting directories by
brute forcing the name in a given directory path.
Module Options
This is a complete list of options available in the scanner/http/brute_dirs auxiliary module:
msf6 auxiliary(scanner/http/brute_dirs) > show options
Module options (auxiliary/scanner/http/brute_dirs):
Name Current Setting Required Description
---- --------------- -------- -----------
DELAY 0 yes The delay between connections, per thread, in milliseconds
FORMAT a,aa,aaa yes The expected directory format (a alpha, d digit, A upperalpha)
JITTER 0 yes The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds.
PATH / yes The path to identify directories
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)
TIMEOUT 20 yes The socket connect/read timeout in seconds
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/brute_dirs auxiliary module:
msf6 auxiliary(scanner/http/brute_dirs) > show advanced
Module advanced options (auxiliary/scanner/http/brute_dirs):
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 directories
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/brute_dirs module can do:
msf6 auxiliary(scanner/http/brute_dirs) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/brute_dirs auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/brute_dirs) > 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:
30: OptInt.new('JITTER', [true, "The delay jitter factor (maximum value by which to +/- DELAY) in milliseconds.", 0]),
31: ])
32:
33: register_advanced_options(
34: [
35: OptInt.new('ErrorCode', [ true, "The expected http code for non existant directories", 404]),
36: OptPath.new('HTTP404Sigs', [ false, "Path of 404 signatures to use",
37: File.join(Msf::Config.data_directory, "wmap", "wmap_404s.txt")
38: ]),
39: OptBool.new('NoDetailMessages', [ false, "Do not display detailed test messages", true ]),
40: OptInt.new('TestThreads', [ true, "Number of test threads", 25])
DELAY
Here is a relevant code snippet related to the "DELAY" error message:
51:
52: timeout = datastore['TIMEOUT']
53:
54: delay_value = datastore['DELAY'].to_i
55: if delay_value < 0
56: raise Msf::OptionValidateError.new(['DELAY'])
57: end
58:
59: jitter_value = datastore['JITTER'].to_i
60: if jitter_value < 0
61: raise Msf::OptionValidateError.new(['JITTER'])
JITTER
Here is a relevant code snippet related to the "JITTER" error message:
56: raise Msf::OptionValidateError.new(['DELAY'])
57: end
58:
59: jitter_value = datastore['JITTER'].to_i
60: if jitter_value < 0
61: raise Msf::OptionValidateError.new(['JITTER'])
62: end
63:
64: tpath = normalize_uri(datastore['PATH'])
65: if tpath[-1,1] != '/'
66: tpath += '/'
ErrorCode
Here is a relevant code snippet related to the "ErrorCode" error message:
75:
76: # You may add multiple formats in the array
77: forma = []
78: forma = datastore['FORMAT'].split(',')
79:
80: ecode = datastore['ErrorCode'].to_i
81: extens.each do |exte|
82:
83: #
84: # Detect error code
85: #
ErrorCode
Here is a relevant code snippet related to the "ErrorCode" error message:
81: extens.each do |exte|
82:
83: #
84: # Detect error code
85: #
86: ecode = datastore['ErrorCode'].to_i
87: begin
88: randdir = Rex::Text.rand_text_alpha(5).chomp
89: randdir << exte
90: res = send_request_cgi({
91: 'uri' => tpath+randdir,
Using code '<ECODE>' as not found.
Here is a relevant code snippet related to the "Using code '<ECODE>' as not found." error message:
113: else
114: print_status("Using custom 404 string of '#{emesg}'")
115: end
116: else
117: ecode = tcode
118: print_status("Using code '#{ecode}' as not found.")
119: end
120:
121: rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
122: conn = false
123: rescue ::Timeout::Error, ::Errno::EPIPE
Format string error
Here is a relevant code snippet related to the "Format string error" error message:
138: # when 'N'
139: # numb << ('A'..'Z')+('0'..'9')
140: # when 'n'
141: # numb << ('a'..'z')+('0'..'9')
142: else
143: print_error("Format string error")
144: return
145: end
146: }
147:
148: #exte.scan(/./) { |c|
NOT Found <WMAP_BASE_URL><TESTSTR> <RES.CODE.TO_I>
Here is a relevant code snippet related to the "NOT Found <WMAP_BASE_URL><TESTSTR> <RES.CODE.TO_I>" error message:
168: 'ctype' => 'text/plain'
169: }, timeout)
170:
171: if (not res or ((res.code.to_i == ecode) or (emesg and res.body.index(emesg))))
172: if dm == false
173: print_status("NOT Found #{wmap_base_url}#{teststr} #{res.code.to_i}")
174: #blah
175: end
176: else
177: if res.code.to_i == 400 and ecode != 400
178: print_error("Server returned an error code. #{wmap_base_url}#{teststr} #{res.code.to_i}")
Server returned an error code. <WMAP_BASE_URL><TESTSTR> <RES.CODE.TO_I>
Here is a relevant code snippet related to the "Server returned an error code. <WMAP_BASE_URL><TESTSTR> <RES.CODE.TO_I>" error message:
173: print_status("NOT Found #{wmap_base_url}#{teststr} #{res.code.to_i}")
174: #blah
175: end
176: else
177: if res.code.to_i == 400 and ecode != 400
178: print_error("Server returned an error code. #{wmap_base_url}#{teststr} #{res.code.to_i}")
179: else
180: print_good("Found #{wmap_base_url}#{teststr} #{res.code.to_i}")
181:
182: report_web_vuln({
183: :host => rhost,
Go back to menu.
Related Pull Requests
- #12475 Merged Pull Request: Small changes to the brute_dirs aux module
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #7586 Merged Pull Request: Fix the exception issue reported in issue #7585
- #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
- #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/admin/oracle/sid_brute
- auxiliary/gather/citrix_published_bruteforce
- auxiliary/gather/ibm_sametime_room_brute
- auxiliary/gather/nuuo_cms_bruteforce
- auxiliary/scanner/http/caidao_bruteforce_login
- auxiliary/scanner/http/cisco_asa_asdm_bruteforce
- auxiliary/scanner/http/joomla_bruteforce_login
- auxiliary/scanner/http/mod_negotiation_brute
- auxiliary/scanner/http/sap_businessobjects_user_brute
- auxiliary/scanner/http/sap_businessobjects_user_brute_web
- auxiliary/scanner/http/typo3_bruteforce
- auxiliary/scanner/misc/ibm_mq_channel_brute
- auxiliary/scanner/oracle/isqlplus_sidbrute
- auxiliary/scanner/oracle/sid_brute
- auxiliary/scanner/oracle/xdb_sid_brute
- auxiliary/scanner/sap/sap_mgmt_con_brute_login
- auxiliary/scanner/sap/sap_soap_rfc_brute_login
- auxiliary/scanner/sap/sap_web_gui_brute_login
- auxiliary/scanner/tftp/tftpbrute
- auxiliary/scanner/mysql/mysql_writable_dirs
- post/multi/gather/dns_bruteforce
Authors
- et
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.