Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in ps_wmi_exec and powershell staging #8330

Merged
merged 3 commits into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/msf/core/post/windows/powershell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def stage_cmd_env(compressed_script, env_suffix = Rex::Text.rand_text_alpha(8))

# Build the set commands
set_env_variable = "[Environment]::SetEnvironmentVariable(" \
"'#{env_variable}'," \
"'#{env_prefix}'," \
"'#{chunk}', 'User')"

# Compress and encode the set command
Expand Down
7 changes: 3 additions & 4 deletions modules/exploits/windows/local/ps_wmi_exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
##


require 'msf/core'
require 'msf/core/post/windows/powershell'
require 'msf/core/post/windows/priv'
require 'msf/core/exploit/powershell/dot_net'
Expand Down Expand Up @@ -49,7 +48,7 @@ def initialize(info={})
OptString.new('PASSWORD', [false, "Password to authenticate with"]),
OptString.new('DOMAIN', [false, "Domain or machine name"]),

], self.class)
])

register_advanced_options(
[
Expand All @@ -60,7 +59,7 @@ def initialize(info={})
false
]),

], self.class)
])

end

Expand All @@ -81,7 +80,7 @@ def build_script
sleep_time = rand(5)+5
psh_payload = "function #{fun_name}{#{psh_payload}};while(1){Start-Sleep -s #{sleep_time};#{fun_name};1}"
end
psh_payload = compress_script(psh_payload_raw, eof)
psh_payload = encode_script(compress_script(psh_payload_raw, eof), eof)
# WMI exec function - this is going into powershell.rb after pull 701 is commited
script = ps_wmi_exec(run_opts)
# Build WMI exec calls to every host into the script to reduce PS instances
Expand Down