Fix CSRF regular expressions as per review
parent
11ef4263a4
commit
04e9398ddd
|
@ -83,8 +83,14 @@ class Metasploit4 < Msf::Exploit::Remote
|
||||||
if res.headers['Location'] =~ /users\/login$/
|
if res.headers['Location'] =~ /users\/login$/
|
||||||
fail_with(Exploit::Failure::UnexpectedReply, 'Failed to retrieve the CSRF token')
|
fail_with(Exploit::Failure::UnexpectedReply, 'Failed to retrieve the CSRF token')
|
||||||
else
|
else
|
||||||
csrf_param = $1 if res.body =~ /<meta[ ]+content="(.*)"[ ]+name="csrf-param"[ ]+\/?>/
|
csrf_param = $1 if res.body =~ /<meta[ ]+content="(.*)"[ ]+name="csrf-param"[ ]*\/?>/i
|
||||||
csrf_token = $1 if res.body =~ /<meta[ ]+content="(.*)"[ ]+name="csrf-token"[ ]+\/?>/
|
csrf_token = $1 if res.body =~ /<meta[ ]+content="(.*)"[ ]+name="csrf-token"[ ]*\/?>/i
|
||||||
|
|
||||||
|
if csrf_param.nil? || csrf_token.nil?
|
||||||
|
csrf_param = $1 if res.body =~ /<meta[ ]+name="csrf-param"[ ]+content="(.*)"[ ]*\/?>/i
|
||||||
|
csrf_token = $1 if res.body =~ /<meta[ ]+name="csrf-token"[ ]+content="(.*)"[ ]*\/?>/i
|
||||||
|
end
|
||||||
|
|
||||||
fail_with(Exploit::Failure::UnexpectedReply, 'Failed to retrieve the CSRF token') if csrf_param.nil? || csrf_token.nil?
|
fail_with(Exploit::Failure::UnexpectedReply, 'Failed to retrieve the CSRF token') if csrf_param.nil? || csrf_token.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue