Skip to content

Commit d8cc2c1

Browse files
committed
Fix rapid7#5315, User configurable options for jenkins_login
Fix rapid7#5315. This patch allows the user to configure the HTTP method for the login, as well as the URL.
1 parent cc87df9 commit d8cc2c1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/metasploit/framework/login_scanner/jenkins.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ def attempt_login(credential)
3737
configure_http_client(cli)
3838
cli.connect
3939
req = cli.request_cgi({
40-
'method'=>'POST',
41-
'uri'=>'/j_acegi_security_check',
40+
'method'=> method,
41+
'uri'=> uri,
4242
'vars_post'=> {
4343
'j_username' => credential.public,
44-
'j_password'=>credential.private
44+
'j_password'=> credential.private
4545
}
4646
})
4747
res = cli.send_recv(req)
48-
if res && !res.headers['location'].include?('loginError')
48+
if res && res.headers['location'] && !res.headers['location'].include?('loginError')
4949
result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: res.headers)
5050
else
5151
result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: res)

modules/auxiliary/scanner/http/jenkins_login.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def initialize
2323

2424
register_options(
2525
[
26+
OptString.new('LOGIN_URL', [true, 'The URL that handles the login process', '/j_acegi_security_check']),
27+
OptEnum.new('HTTP_METHOD', [true, 'The HTTP method to use for the login', 'POST', ['GET', 'POST']]),
2628
Opt::RPORT(8080)
2729
], self.class)
2830

@@ -44,6 +46,8 @@ def run_host(ip)
4446

4547
scanner = Metasploit::Framework::LoginScanner::Jenkins.new(
4648
configure_http_login_scanner(
49+
uri: datastore['LOGIN_URL'],
50+
method: datastore['HTTP_METHOD'],
4751
cred_details: cred_collection,
4852
stop_on_success: datastore['STOP_ON_SUCCESS'],
4953
bruteforce_speed: datastore['BRUTEFORCE_SPEED'],

0 commit comments

Comments
 (0)