Skip to content

Commit f39e378

Browse files
committed
Land rapid7#8330, fix ps_wmi_exec and psh staging
2 parents 405f2c6 + 3cbeebe commit f39e378

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/msf/core/post/windows/powershell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def stage_cmd_env(compressed_script, env_suffix = Rex::Text.rand_text_alpha(8))
127127
count = 8000
128128
while index < compressed_script.size - 1
129129
# Define random, but serialized variable name
130-
env_prefix = format("%05d%s", ((index + 8000) / 8000), env_suffix)
130+
env_variable = format("%05d%s", ((index + 8000) / 8000), env_suffix)
131131

132132
# Create chunk
133133
chunk = compressed_script[index, count]

modules/exploits/windows/local/ps_wmi_exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def build_script
8080
sleep_time = rand(5)+5
8181
psh_payload = "function #{fun_name}{#{psh_payload}};while(1){Start-Sleep -s #{sleep_time};#{fun_name};1}"
8282
end
83-
psh_payload = compress_script(psh_payload_raw, eof)
83+
psh_payload = encode_script(compress_script(psh_payload_raw, eof), eof)
8484
# WMI exec function - this is going into powershell.rb after pull 701 is commited
8585
script = ps_wmi_exec(run_opts)
8686
# Build WMI exec calls to every host into the script to reduce PS instances

0 commit comments

Comments
 (0)