Skip to content

Commit d788a3b

Browse files
committed
Update check
1 parent 710ae11 commit d788a3b

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

modules/exploits/linux/http/selenium_greed_firefox_rce_cve_2022_28108.rb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,26 @@ def initialize(info = {})
6464
end
6565

6666
def check
67+
# Request for Selenium Grid version 4
68+
v4res = send_request_cgi({
69+
'method' => 'GET',
70+
'uri' => normalize_uri(target_uri.path, 'status')
71+
})
72+
if v4res && v4res.get_json_document && v4res.get_json_document.include?('value') &&
73+
v4res.get_json_document['value'].include?('message')
74+
if v4res.get_json_document['value']['message'] == 'Selenium Grid ready.'
75+
return Exploit::CheckCode::Detected('Selenium Grid version 4.x detected and ready.')
76+
elsif v4res.get_json_document['value']['message'].downcase.include?('selenium grid')
77+
return Exploit::CheckCode::Unknown('Selenium Grid version 4.x detected but not ready.')
78+
end
79+
end
80+
6781
# Request for Selenium Grid version 3
6882
v3res = send_request_cgi({
6983
'method' => 'GET',
7084
'uri' => normalize_uri(target_uri.path)
7185
})
72-
if v3res&.code != 200
73-
# Request for Selenium Grid version 4
74-
v4res = send_request_cgi({
75-
'method' => 'GET',
76-
'uri' => normalize_uri(target_uri.path, 'status')
77-
})
78-
if v4res && v4res.get_json_document && v4res.get_json_document.include?('value') &&
79-
v4res.get_json_document['value'].include?('message')
80-
if v4res.get_json_document['value']['message'] == 'Selenium Grid ready.'
81-
return Exploit::CheckCode::Detected('Selenium Grid version 4.x detected and ready.')
82-
elsif v4res.get_json_document['value']['message'].downcase.include?('selenium grid')
83-
return Exploit::CheckCode::Unknown('Selenium Grid version 4.x detected but not ready.')
84-
end
85-
end
86-
87-
return Exploit::CheckCode::Unknown('Unexpected server reply.')
88-
end
86+
return Exploit::CheckCode::Unknown('Unexpected server reply.') unless v3res&.code == 200
8987

9088
js_code = v3res.get_html_document.css('script').find { |script| script.text.match(/var json = Object.freeze\('(.*?)'\);/) }
9189
return Exploit::CheckCode::Unknown('Unable to determine the version.') unless js_code

0 commit comments

Comments
 (0)