#!/usr/bin/perl

# bin/ftp_bounce.saint
#
# Check for FTP bounce vulnerability
#
# Rewritten by WWDSI (s.k.) 6/01

require 'config/paths.pl';
require 'perl/misc.pl';

print "BEGIN\n";

die "Usage: ftp_bounce.saint <target>" if $#ARGV < 0;
$target = $ARGV[0];

$cmd = "$FTP_SCAN $target 127.0.0.1 21 21";
die "Can't open $FTP_SCAN: $!\n" unless open(FTPSCAN, "$cmd 2>&1|");

while(<FTPSCAN>) {
 chop;
 if (/connected/) {
   $service = "ftp";
   $status = "a";
   $severity = "yi";
   $trustee = "ANY\@$target";
   $trusted = "ANY\@$target";
   $service_output = "FTP bounce";
   $text = "FTP server can do ftp bounce";
   &saint_print();
 }
}
close(FTPSCAN);
