=====================================================================
                                  CERT-Renater

                       Note d'Information No. 2004/VULN521
_____________________________________________________________________

DATE                      : 01/12/2004

HARDWARE PLATFORM(S)      : /

OPERATING SYSTEM(S)       : Systems running Cyrus imapd.

======================================================================
________________________________________________________________________

OpenPKG Security Advisory                            The OpenPKG Project
http://www.openpkg.org/security.html              http://www.openpkg.org
openpkg-security@openpkg.org                         openpkg@openpkg.org
OpenPKG-SA-2004.051                                          29-Nov-2004
________________________________________________________________________

Package:             imapd
Vulnerability:       arbitrary code execution
OpenPKG Specific:    no

Affected Releases:   Affected Packages:          Corrected Packages:
OpenPKG CURRENT      <= imapd-2.2.9-20041123     >= imapd-2.2.10-20041124
OpenPKG 2.2          <= imapd-2.2.8-2.2.0        >= imapd-2.2.8-2.2.1
OpenPKG 2.1          <= imapd-2.2.6-2.1.0        >= imapd-2.2.6-2.1.1

Affected Releases:   Dependent Packages: none

Description:
   According to a security advisory from Stefan Esser [0], several
   vulnerabilities exist in Cyrus imapd. The updated OpenPKG packages fix
   all these problems.

   When the option "IMAPMAGICPLUS" is activated on a server, the
   "PROXY" and "LOGIN" commands suffer a standard stack overflow,
   because the username is not checked against a maximum length. The
   Common Vulnerabilities and Exposures (CVE) project assigned the id
   CAN-2004-1011 [2] to the problem.

   Due to a bug within the argument parser of the "PARTIAL" command
   buffer positions outside the allocated memory buffer may be accessed.
   The Common Vulnerabilities and Exposures (CVE) project assigned the id
   CAN-2004-1012 [3] to the problem.

   The argument parser of the "FETCH" command suffers a similar bug. The
   Common Vulnerabilities and Exposures (CVE) project assigned the id
   CAN-2004-1013 [4] to the problem.

   Under memory allocation failure conditions the "cmd_append" handler
   supporting "MULTIAPPENDS" may enter code paths doing post increments
   whose behavior is undefined in ANSI C. The same function also suffers
   from a integer wrap. No CVE id.

   Another "IMAPMAGICPLUS" overflow was later discovered by Thomas
   Klaeger in proxyd.c "proxyd_canon_user" function. The Common
   Vulnerabilities and Exposures (CVE) project assigned the id
   CAN-2004-1015 [5] to the problem.

   Sebastian Krahmer mentioned a missing NUL-termination in global.c and
   provided a patch. No CVE id.

   Please check whether you are affected by running "<prefix>/bin/openpkg
   rpm -q imapd". If you have the "imapd" package installed and its
   version is affected (see above), we recommend that you immediately
   upgrade it [6][7].

Solution:
   Select the updated source RPM appropriate for your OpenPKG release
   [8][9], fetch it from the OpenPKG FTP service [10][11] or a mirror
   location, verify its integrity [12], build a corresponding binary RPM
   from it [6] and update your OpenPKG installation by applying the
   binary RPM [7]. For the most recent release OpenPKG 2.2, perform the
   following operations to permanently fix the security problem (for
   other releases adjust accordingly).

   $ ftp ftp.openpkg.org
   ftp> bin
   ftp> cd release/2.2/UPD
   ftp> get imapd-2.2.8-2.2.1.src.rpm
   ftp> bye
   $ <prefix>/bin/openpkg rpm -v --checksig imapd-2.2.8-2.2.1.src.rpm
   $ <prefix>/bin/openpkg rpm --rebuild imapd-2.2.8-2.2.1.src.rpm
   $ su -
   # <prefix>/bin/openpkg rpm -Fvh <prefix>/RPM/PKG/imapd-2.2.8-2.2.1.*.rpm

   Additionally, we recommend that you rebuild and reinstall
   all dependent packages (see above), if any, too [6][7].
________________________________________________________________________

References:
   [0] http://security.e-matters.de/advisories/152004.html
   [1] http://asg.web.cmu.edu/cyrus/imapd/
   [2] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1011
   [3] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1012
   [4] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1013
   [5] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1015
   [6] http://www.openpkg.org/tutorial.html#regular-source
   [7] http://www.openpkg.org/tutorial.html#regular-binary
   [8] ftp://ftp.openpkg.org/release/2.2/UPD/imapd-2.2.8-2.2.1.src.rpm
   [9] ftp://ftp.openpkg.org/release/2.1/UPD/imapd-2.2.6-2.1.1.src.rpm
   [10] ftp://ftp.openpkg.org/release/2.2/UPD/
   [11] ftp://ftp.openpkg.org/release/2.1/UPD/
   [12] http://www.openpkg.org/security.html#signature
________________________________________________________________________

For security reasons, this advisory was digitally signed with the
OpenPGP public key "OpenPKG <openpkg@openpkg.org>" (ID 63C4CB9F) of the
OpenPKG project which you can retrieve from http://pgp.openpkg.org and
hkp://pgp.openpkg.org. Follow the instructions on http://pgp.openpkg.org/
for details on how to verify the integrity of this advisory.
________________________________________________________________________

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

         =========================================================
         Les serveurs de référence du CERT-Renater
         http://www.urec.fr/securite
         http://www.cru.fr/securite
         http://www.renater.fr
         =========================================================
         + CERT-RENATER          | tel : 01-53-94-20-44          +
         + 151 bd de l'Hopital   | fax : 01-53-94-20-41          +
         + 75013 Paris           | email: certsvp@renater.fr     +
         =========================================================






