Skip to content

Commit 49d998f

Browse files
committed
catch invalid tokens
1 parent f4ffade commit 49d998f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/exploits/multi/http/jenkins_script_console.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,15 @@ def exploit
155155
@crumb = nil
156156
if res.code != 200
157157
if datastore['API_TOKEN']
158-
print_status('Authenticating and requesting crumb...')
158+
print_status('Authenticating with token...')
159159
res = send_request_cgi({
160160
'method' => 'GET',
161161
'uri' => normalize_uri(@uri.path, "crumbIssuer/api/json"),
162162
'authorization' => basic_auth(datastore['USERNAME'], datastore['API_TOKEN'])
163163
})
164+
if (res and res.code == 401)
165+
fail_with(Failure::NoAccess, 'Login failed')
166+
end
164167
else
165168
print_status('Logging in...')
166169
res = send_request_cgi({

0 commit comments

Comments
 (0)