Apache Tomcat User Enumeration - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/tomcat_enum metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Apache Tomcat User Enumeration
Module: auxiliary/scanner/http/tomcat_enum
Source code: modules/auxiliary/scanner/http/tomcat_enum.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +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: CVE-2009-0580
This module enumerates Apache Tomcat's usernames via malformed requests to j_security_check, which can be found in the web administration package. It should work against Tomcat servers 4.1.0 - 4.1.39, 5.5.0 - 5.5.27, and 6.0.0 - 6.0.18. Newer versions no longer have the "admin" package by default. The 'admin' package is no longer provided for Tomcat 6 and later versions.
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/tomcat_enum
msf auxiliary(tomcat_enum) > show options
... show and set options ...
msf auxiliary(tomcat_enum) > set RHOSTS ip-range
msf auxiliary(tomcat_enum) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(tomcat_enum) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(tomcat_enum) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(tomcat_enum) > 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/tomcat_enum auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/tomcat_enum
msf6 auxiliary(scanner/http/tomcat_enum) > show info
Name: Apache Tomcat User Enumeration
Module: auxiliary/scanner/http/tomcat_enum
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Heyder Andrade <[email protected]>
Leandro Oliveira <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
DB_ALL_CREDS false no Try each user/password couple stored in the current database
DB_ALL_PASS false no Add all passwords in the current database to the list
DB_ALL_USERS false no Add all users in the current database to the list
PASSWORD no A specific password to authenticate with
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 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /admin/j_security_check yes The path of the Apache Tomcat Administration page
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME no A specific username to authenticate as
USER_FILE /opt/metasploit-framework/embedded/framework/data/wordlists/tomcat_mgr_default_users.txt yes File containing users, one per line
VERBOSE true yes Whether to print output for all attempts
VHOST no HTTP server virtual host
Description:
This module enumerates Apache Tomcat's usernames via malformed
requests to j_security_check, which can be found in the web
administration package. It should work against Tomcat servers 4.1.0
- 4.1.39, 5.5.0 - 5.5.27, and 6.0.0 - 6.0.18. Newer versions no
longer have the "admin" package by default. The 'admin' package is
no longer provided for Tomcat 6 and later versions.
References:
http://www.securityfocus.com/bid/35196
https://nvd.nist.gov/vuln/detail/CVE-2009-0580
OSVDB (55055)
Module Options
This is a complete list of options available in the scanner/http/tomcat_enum auxiliary module:
msf6 auxiliary(scanner/http/tomcat_enum) > show options
Module options (auxiliary/scanner/http/tomcat_enum):
Name Current Setting Required Description
---- --------------- -------- -----------
BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
DB_ALL_CREDS false no Try each user/password couple stored in the current database
DB_ALL_PASS false no Add all passwords in the current database to the list
DB_ALL_USERS false no Add all users in the current database to the list
PASSWORD no A specific password to authenticate with
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 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /admin/j_security_check yes The path of the Apache Tomcat Administration page
THREADS 1 yes The number of concurrent threads (max one per host)
USERNAME no A specific username to authenticate as
USER_FILE /opt/metasploit-framework/embedded/framework/data/wordlists/tomcat_mgr_default_users.txt yes File containing users, one per line
VERBOSE true yes Whether to print output for all attempts
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/tomcat_enum auxiliary module:
msf6 auxiliary(scanner/http/tomcat_enum) > show advanced
Module advanced options (auxiliary/scanner/http/tomcat_enum):
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
MaxGuessesPerService 0 no Maximum number of credentials to try per service instance. If set to zero or a non-number, this option will not be used.
MaxGuessesPerUser 0 no Maximum guesses for a particular username for the service instance. Note that users are considered unique among different services, so a user at 10.1.1.1:22
is different from one at 10.2.2.2:22, and both will be tried up to the MaxGuessesPerUser limit. If set to zero or a non-number, this option will not be use
d.
MaxMinutesPerService 0 no Maximum time in minutes to bruteforce the service instance. If set to zero or a non-number, this option will not be used.
PASSWORD_SPRAY false yes Reverse the credential pairing order. For each password, attempt every possible user.
REMOVE_PASS_FILE false yes Automatically delete the PASS_FILE on module completion
REMOVE_USERPASS_FILE false yes Automatically delete the USERPASS_FILE on module completion
REMOVE_USER_FILE false yes Automatically delete the USER_FILE on module completion
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
TRANSITION_DELAY 0 no Amount of time (in minutes) to delay before transitioning to the next user in the array (or password when PASSWORD_SPRAY=true)
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/tomcat_enum module can do:
msf6 auxiliary(scanner/http/tomcat_enum) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/tomcat_enum auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/tomcat_enum) > 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.
<FULL_URI> - Unable to enumerate users with this URI
Here is a relevant code snippet related to the "<FULL_URI> - Unable to enumerate users with this URI" error message:
55: false
56: end
57:
58: def run_host(ip)
59: unless has_j_security_check?
60: print_error("#{full_uri} - Unable to enumerate users with this URI")
61: return
62: end
63:
64: @users_found = {}
65:
<FULL_URI> - No users found.
Here is a relevant code snippet related to the "<FULL_URI> - No users found." error message:
66: each_user_pass { |user,pass|
67: do_login(user)
68: }
69:
70: if(@users_found.empty?)
71: print_status("#{full_uri} - No users found.")
72: else
73: print_good("#{full_uri} - Users found: #{@users_found.keys.sort.join(", ")}")
74: report_note(
75: :host => rhost,
76: :port => rport,
<FULL_URI> - Apache Tomcat <USER> not found
Here is a relevant code snippet related to the "<FULL_URI> - Apache Tomcat <USER> not found" error message:
90: 'uri' => normalize_uri(target_uri.path),
91: 'data' => post_data,
92: }, 20)
93:
94: if res and res.code == 200 and !res.get_cookies.empty?
95: vprint_error("#{full_uri} - Apache Tomcat #{user} not found ")
96: elsif res and res.code == 200 and res.body =~ /invalid username/i
97: vprint_error("#{full_uri} - Apache Tomcat #{user} not found ")
98: elsif res and res.code == 500
99: # Based on: http://archives.neohapsis.com/archives/bugtraq/2009-06/0047.html
100: vprint_good("#{full_uri} - Apache Tomcat #{user} found ")
<FULL_URI> - Apache Tomcat <USER> not found
Here is a relevant code snippet related to the "<FULL_URI> - Apache Tomcat <USER> not found" error message:
92: }, 20)
93:
94: if res and res.code == 200 and !res.get_cookies.empty?
95: vprint_error("#{full_uri} - Apache Tomcat #{user} not found ")
96: elsif res and res.code == 200 and res.body =~ /invalid username/i
97: vprint_error("#{full_uri} - Apache Tomcat #{user} not found ")
98: elsif res and res.code == 500
99: # Based on: http://archives.neohapsis.com/archives/bugtraq/2009-06/0047.html
100: vprint_good("#{full_uri} - Apache Tomcat #{user} found ")
101: @users_found[user] = :reported
102: elsif res and res.body.empty? and res.headers['Location'] !~ /error\.jsp$/
Location
Here is a relevant code snippet related to the "Location" error message:
97: vprint_error("#{full_uri} - Apache Tomcat #{user} not found ")
98: elsif res and res.code == 500
99: # Based on: http://archives.neohapsis.com/archives/bugtraq/2009-06/0047.html
100: vprint_good("#{full_uri} - Apache Tomcat #{user} found ")
101: @users_found[user] = :reported
102: elsif res and res.body.empty? and res.headers['Location'] !~ /error\.jsp$/
103: # Based on: http://archives.neohapsis.com/archives/bugtraq/2009-06/0047.html
104: print_good("#{full_uri} - Apache Tomcat #{user} found ")
105: @users_found[user] = :reported
106: else
107: print_error("#{full_uri} - NOT VULNERABLE")
<FULL_URI> - NOT VULNERABLE
Here is a relevant code snippet related to the "<FULL_URI> - NOT VULNERABLE" error message:
102: elsif res and res.body.empty? and res.headers['Location'] !~ /error\.jsp$/
103: # Based on: http://archives.neohapsis.com/archives/bugtraq/2009-06/0047.html
104: print_good("#{full_uri} - Apache Tomcat #{user} found ")
105: @users_found[user] = :reported
106: else
107: print_error("#{full_uri} - NOT VULNERABLE")
108: return :abort
109: end
110:
111: rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
112: print_error("#{full_uri} - UNREACHABLE")
<FULL_URI> - UNREACHABLE
Here is a relevant code snippet related to the "<FULL_URI> - UNREACHABLE" error message:
107: print_error("#{full_uri} - NOT VULNERABLE")
108: return :abort
109: end
110:
111: rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
112: print_error("#{full_uri} - UNREACHABLE")
113: return :abort
114: end
115: end
116: end
117:
Go back to menu.
Related Pull Requests
- #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
- #6812 Merged Pull Request: Resolve #6807, remove all OSVDB references.
- #6708 Merged Pull Request: Add module documentation feature in Framework
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6281 Merged Pull Request: Modify the printed URL to add https:// when SSL is used.
- #5068 Merged Pull Request: Clean up authors
- #3359 Merged Pull Request: Resolved some more Set-Cookie warnings
- #2525 Merged Pull Request: Change module boilerplate
- #2426 Merged Pull Request: Find and replace Msf::Config.install_root, "data"
- #2235 Merged Pull Request: [FixRM 6264] Check required vulnerable component before testing
- #1655 Merged Pull Request: Minor fixes to tomcat_enum
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
- #1047 Merged Pull Request: Set normalize uri on modules
References
- BID-35196
- CVE-2009-0580
- OSVDB (55055)
See Also
Check also the following modules related to this module:
- auxiliary/scanner/http/tomcat_mgr_login
- auxiliary/admin/http/tomcat_administration
- auxiliary/admin/http/tomcat_ghostcat
- auxiliary/admin/http/tomcat_utf8_traversal
- exploit/multi/http/tomcat_jsp_upload_bypass
- exploit/multi/http/tomcat_mgr_deploy
- exploit/multi/http/tomcat_mgr_upload
- exploit/windows/http/tomcat_cgi_cmdlineargs
- post/multi/gather/tomcat_gather
- auxiliary/dos/http/apache_tomcat_transfer_encoding
- post/windows/gather/enum_tomcat
- auxiliary/scanner/http/apache_userdir_enum
- auxiliary/scanner/http/cisco_ironport_enum
- auxiliary/scanner/http/drupal_views_user_enum
- auxiliary/scanner/http/enum_wayback
- auxiliary/scanner/http/gitlab_graphql_user_enum
- auxiliary/scanner/http/gitlab_user_enum
- auxiliary/scanner/http/influxdb_enum
- auxiliary/scanner/http/infovista_enum
- auxiliary/scanner/http/jenkins_enum
- auxiliary/scanner/http/jira_user_enum
- auxiliary/scanner/http/ntlm_info_enumeration
- auxiliary/scanner/http/radware_appdirector_enum
- auxiliary/scanner/http/rfcode_reader_enum
- auxiliary/scanner/http/sap_businessobjects_user_enum
- auxiliary/scanner/http/sap_businessobjects_version_enum
- auxiliary/scanner/http/sentry_cdu_enum
- auxiliary/scanner/http/sevone_enum
- auxiliary/scanner/http/squiz_matrix_user_enum
- auxiliary/scanner/http/synology_forget_passwd_user_enum
- auxiliary/scanner/http/wordpress_login_enum
Authors
- Heyder Andrade <heyder.andrade[at]gmail.com>
- Leandro Oliveira <leandrofernando[at]gmail.com>
Version
This page has been produced using Metasploit Framework version 6.1.36-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.