Skip to content

Commit c0c1ac3

Browse files
author
Brent Cook
committed
Land rapid7#8056, Fix how the psh mixin issues Meterpreter commands
2 parents d55b680 + 2701fef commit c0c1ac3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PATH
1414
metasploit-concern
1515
metasploit-credential
1616
metasploit-model
17-
metasploit-payloads (= 1.2.18)
17+
metasploit-payloads (= 1.2.19)
1818
metasploit_data_models
1919
metasploit_payloads-mettle (= 0.1.7)
2020
msgpack
@@ -190,7 +190,7 @@ GEM
190190
activemodel (~> 4.2.6)
191191
activesupport (~> 4.2.6)
192192
railties (~> 4.2.6)
193-
metasploit-payloads (1.2.18)
193+
metasploit-payloads (1.2.19)
194194
metasploit_data_models (2.0.14)
195195
activerecord (~> 4.2.6)
196196
activesupport (~> 4.2.6)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def initialize(info = {})
2929
# Returns true if powershell is installed
3030
#
3131
def have_powershell?
32-
cmd_exec('cmd.exe /c "echo. | powershell get-host"') =~ /Name.*Version.*InstanceId/m
32+
cmd_exec('cmd.exe', '/c "echo. | powershell get-host"') =~ /Name.*Version.*InstanceId/m
3333
end
3434

3535
#
@@ -88,9 +88,9 @@ def execute_script(script, greedy_kill = false)
8888
script = encode_script(script.to_s)
8989
end
9090

91-
ps_string = "#{ps_bin} -EncodedCommand #{script} -InputFormat None"
92-
vprint_good "EXECUTING:\n#{ps_string}"
93-
cmd_out = session.sys.process.execute(ps_string, nil, { 'Hidden' => true, 'Channelized' => true })
91+
ps_string = "-EncodedCommand #{script} -InputFormat None"
92+
vprint_good "EXECUTING:\n#{ps_bin} #{ps_string}"
93+
cmd_out = session.sys.process.execute(ps_bin, ps_string, { 'Hidden' => true, 'Channelized' => true })
9494

9595
# Subtract prior PIDs from current
9696
if greedy_kill

metasploit-framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Gem::Specification.new do |spec|
6565
# are needed when there's no database
6666
spec.add_runtime_dependency 'metasploit-model'
6767
# Needed for Meterpreter
68-
spec.add_runtime_dependency 'metasploit-payloads', '1.2.18'
68+
spec.add_runtime_dependency 'metasploit-payloads', '1.2.19'
6969
# Needed for the next-generation POSIX Meterpreter
7070
spec.add_runtime_dependency 'metasploit_payloads-mettle', '0.1.7'
7171
# Needed by msfgui and other rpc components

0 commit comments

Comments
 (0)