copyright | disclaimer | privacy | contact  
Australia's Leading Computer Emergency Response Team
 
Search this site

 
On this site

 > HOME
 > About AusCERT
 > Membership
 > Contact Us
 > PKI Services
 > Training
 > Publications
 > Sec. Bulletins
 > Conferences
 > News & Media
 > Services
 > Web Log
 > Site Map
 > Site Help
 > Member login





 

ESB-2004.0527 -- iDEFENSE Security Advisory 08.18.04 -- Courier-IMAP Remote Format String Vulnerability

Date: 23 August 2004

Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

===========================================================================
             AUSCERT External Security Bulletin Redistribution

           ESB-2004.0527 -- iDEFENSE Security Advisory 08.18.04
              Courier-IMAP Remote Format String Vulnerability
                              23 August 2004

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:                Courier-IMAP 2.2.1 and prior
Publisher:              iDEFENSE
Operating System:       Linux variants
                        UNIX variants
Impact:                 Execute Arbitrary Code/Commands
Access:                 Remote/Unauthenticated
CVE Names:              CAN-2004-0777

Comment: Systems running Courier-IMAP 2.2.1 and prior are vulnerable if the
         option DEBUG_LOGIN is set to 1 or 2 in the imapd configuration file.

- --------------------------BEGIN INCLUDED TEXT--------------------

Courier-IMAP Remote Format String Vulnerability

iDEFENSE Security Advisory 08.18.04:

I. BACKGROUND

Courier-IMAP is an IMAP/POP3 mail server popular on sites utilizing
Qmail/Exim/Postfix. More information is available here:

    http://www.courier-mta.org/imap/

II. DESCRIPTION

Remote exploitation of a format string vulnerability in Double Precision
Inc.'s, Courier-IMAP daemon allows attackers to execute arbitrary code.

The vulnerability specifically exists within the auth_debug() function
defined in authlib/debug.c:

void auth_debug( const char *fmt, va_list ap ) {
    char    buf[DEBUG_MESSAGE_SIZE];
    int     i;
    int     len;

    // print into buffer to be able to replace control and other 
    // unwanted chars.
    vsnprintf( buf, DEBUG_MESSAGE_SIZE, fmt, ap );
    len = strlen( buf );

    // replace nonprintable chars by dot
    for( i=0 ; i<len ; i++ )
            if( !isprint(buf[i]) )
                    buf[i] = '.';

    // emit it
    fprintf( stderr, buf );   // <- Format String Vulnerability
    fprintf( stderr, "\n" );
}

The 'buf' variable utilized in the fprintf() call is attacker-controlled
and can contain format string modifiers allowing an attacker to
manipulate the stack and eventually execute arbitrary code.

III. ANALYSIS

Successful exploitation does not require authentication thereby allowing
any remote attacker to execute arbitrary code under the privileges of
the user that the IMAP daemon runs as. The vulnerable function
auth_debug() is only called if login debugging is enabled requiring that
the 'DEBUG_LOGIN' be set to either '1' or '2' in the imapd configuration
file.

IV. DETECTION

iDEFENSE has confirmed the existence of this vulnerability in
Courier-IMAP, v2.2.1. It is reported that all versions of Courier-IMAP
from 1.6.0 to 2.2.1 inclusive are vulnerable.

V. WORKAROUND

Disable the login debugging option of Courier-IMAP. This can be
accomplished by setting 'DEBUG_LOGIN' to '0' in the configuration file
usually located at /usr/lib/courier-imap/etc/imapd.

VI. VENDOR RESPONSE

This issue has been resolved in the latest version of Courier IMAP
(v3.0.7). As well, the default setting of 'DEBUG_LOGIN' is '0'.

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CAN-2004-0777 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org), which standardizes names for
security problems.

VIII. DISCLOSURE TIMELINE

08/10/2004   Initial vendor contact
08/10/2004   iDEFENSE clients notified
08/11/2004   Initial vendor response
08/18/2004   Public disclosure

IX. CREDIT

An anonymous contributor is credited with discovering this
vulnerability.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

X. LEGAL NOTICES

Copyright (c) 2004 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an as is condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================

-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBQSmB5yh9+71yA2DNAQJReQP/VjFFC+DOvlhCdGdZKvuC67zwdLZW/AD0
uwAdYgtDYvLD0/kbAtzcRzKWzC++4aE2AJ+ETj+LIbJlZcSN24Z6nuik6YL91p4n
7hSTnNTIYQ5Jkg1NudLl5Q9tu/+TnbF/8Jof7Jbu4tfx+ZqgoMNE2LPIrbSVxnbb
5tn1qxzWWGk=
=a0jS
-----END PGP SIGNATURE-----