Skip to content

Commit 97050a6

Browse files
committed
Fix nil bug in scan
1 parent d48ec09 commit 97050a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/exploits/multi/http/phpmyadmin_preg_replace.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ def exploit
145145
fail_with(Failure::NotFound, "Failed to retrieve webpage.")
146146
end
147147

148-
token = login.headers['Location'].scan(/token=(.*)[&|$]/).flatten.first
148+
if login.redirect?
149+
token = login.redirection.to_s.scan(/token=(.*)[&|$]/).flatten.first
150+
else
151+
fail_with(Failure::NotFound, "Couldn't find token. Wrong PMA version?")
152+
end
149153

150154
cookies = login.get_cookies
151155

0 commit comments

Comments
 (0)