Home    |    View Topics    |    Search    |    Contact Us    |   



Category:   Application (E-mail Server)  >   Courier Mail Server Vendors:   Double Precision, Inc.
Courier-IMAP Format String Flaw in auth_debug() Lets Remote Users Execute Arbitrary Code
SecurityTracker Alert ID:  1010982
SecurityTracker URL:
CVE Reference:   CVE-2004-0777   (Links to External Site)
Date:  Aug 18 2004
Impact:   Execution of arbitrary code via network, User access via network
Fix Available:  Yes  Vendor Confirmed:  Yes  
Version(s): Prior to Courier 0.46; Courier-IMAP 1.6.0 to 2.2.1
Description:   iDEFENSE reported a format string vulnerability in Courier-IMAP. A remote user can execute arbitrary code on the target system.

It is reported that the auth_debug() function in 'authlib/debug.c' contains an fprintf() statement that does not include the proper formatting string and processes user-supplied data.

The vulnerable function is called only if login debugging is enabled and the 'DEBUG_LOGIN' value is set to either '1' or '2' in the imapd configuration file.

The original advisory is available at:

Impact:   A remote user can execute arbitrary code on the target system with the privileges of the Courier-IMAP process.
Solution:   The vendor has released a fixed version (Courier 0.46; Courier-IMAP 3.0.7), available at:

Vendor URL: (Links to External Site)
Cause:   Input validation error, State error
Underlying OS:  Linux (Any), UNIX (Any)

Message History:   This archive entry has one or more follow-up message(s) listed below.
Aug 20 2004 (Gentoo Issues Fix) Courier-IMAP Format String Flaw in auth_debug() Lets Remote Users Execute Arbitrary Code
Gentoo has released a fix.

 Source Message Contents

Subject:  iDEFENSE Security Advisory 08.18.04: Courier-IMAP Remote Format

Courier-IMAP Remote Format String Vulnerability

iDEFENSE Security Advisory 08.18.04
August 18, 2004


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


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=20
    // unwanted chars.
    vsnprintf( buf, DEBUG_MESSAGE_SIZE, fmt, ap );
    len =3D strlen( buf );

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

    // 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.


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



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.


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.


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'.


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 (, which standardizes names for
security problems.


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


An anonymous contributor is credited with discovering this

Get paid for vulnerability research


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 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.

Go to the Top of This SecurityTracker Archive Page

Home   |    View Topics   |    Search   |    Contact Us

This web site uses cookies for web analytics. Learn More

Copyright 2021, LLC