-----BEGIN PGP SIGNED MESSAGE-----

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

           ESB-2003.0153 -- FreeBSD-SA-03:04.sendmail [REVISED]
                  sendmail header parsing buffer overflow
                               06 March 2003

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

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

Product:                sendmail
Vendor:                 FreeBSD
Operating System:       FreeBSD prior to 4.8-RELEASE
                        FreeBSD prior to 5.0-RELEASE-p4
                        FreeBSD 4-STABLE prior to 03/03/2003
Impact:                 Root Compromise
Access Required:        Remote

Ref:                    AA-2003.01
                        ESB-2003.0140

Comment: CVE Id: CAN-2002-1337

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

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

=============================================================================
FreeBSD-SA-03:04.sendmail                                   Security Advisory
                                                          The FreeBSD Project

Topic:          sendmail header parsing buffer overflow

Category:       contrib
Module:         contrib_sendmail
Announced:      2003-03-03
Revised:        2003-03-04
Credits:        Mark Dowd (ISS)
Affects:        All releases prior to 4.8-RELEASE and 5.0-RELEASE-p4
                FreeBSD 4-STABLE prior to the correction date
Corrected:      2003-03-03 18:03:18 UTC (RELENG_4)
                2003-03-03 17:19:49 UTC (RELENG_5_0)
                2003-03-03 17:20:23 UTC (RELENG_4_7)
                2003-03-03 17:21:58 UTC (RELENG_4_6)
                2003-03-03 17:22:07 UTC (RELENG_4_5)
                2003-03-03 17:22:16 UTC (RELENG_4_4)
                2003-03-03 17:22:26 UTC (RELENG_4_3)
                2003-03-03 17:23:11 UTC (RELENG_3)
FreeBSD only:   NO

0.   Revision History

v1.0  2003-03-03  Initial release
v1.1  2003-03-04  Added correction details for each branch.

I.   Background

FreeBSD includes sendmail(8), a general purpose internetwork mail
routing facility, as the default Mail Transfer Agent (MTA).

II.  Problem Description

ISS has identified a buffer overflow that may occur during header
parsing in all versions of sendmail after version 5.79.

In addition, Sendmail, Inc. has identified and corrected a defect in
buffer handling within sendmail's RFC 1413 ident protocol support.

III. Impact

A remote attacker could create a specially crafted message that may
cause sendmail to execute arbitrary code with the privileges of the
user running sendmail, typically root.  The malicious message might be
handled (and therefore the vulnerability triggered) by the initial
sendmail MTA, any relaying sendmail MTA, or by the delivering sendmail
process.  Exploiting this defect is particularly difficult, but is
believed to be possible.

The defect in the ident routines is not believed to be exploitable.

IV.  Workaround

There is no workaround, other than not using sendmail.

V.   Solution

Do one of the following:

1) Upgrade your vulnerable system to 4-STABLE; or to the RELENG_5_0,
RELENG_4_7, or RELENG_4_6 security branch dated after the correction
date (5.0-RELEASE-p4, 4.7-RELEASE-p7, or 4.6.2-RELEASE-p10,
respectively).

[NOTE: At the time of this writing, the FreeBSD 4-STABLE branch is
 labeled `4.8-RC1'.]

2) To patch your present system:

The following patch has been verified to apply to FreeBSD 5.0, 4.7,
and 4.6 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail.patch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail.patch.asc

b) Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch
# cd /usr/src/lib/libsm
# make obj && make depend && make
# cd /usr/src/lib/libsmutil
# make obj && make depend && make
# cd /usr/src/usr.sbin/sendmail
# make obj && make depend && make && make install

c) Restart sendmail.  Execute the following command as root.

# /bin/sh /etc/rc.sendmail restart

3) For i386 systems only, a patched sendmail binary is available.
Select the correct binary based on your FreeBSD version and whether or
not you want STARTTLS support.  If you want STARTTLS support, you must
have the crypto distribution installed.

a) Download the relevant binary from the location below, and verify
the detached PGP signature using your PGP utility.

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.6-i386-crypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.6-i386-crypto.bin.gz.asc

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.6-i386-nocrypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.6-i386-nocrypto.bin.gz.asc

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.7-i386-crypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.7-i386-crypto.bin.gz.asc

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.7-i386-nocrypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-4.7-i386-nocrypto.bin.gz.asc

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-5.0-i386-crypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-5.0-i386-crypto.bin.gz.asc

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-5.0-i386-nocrypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:04/sendmail-5.0-i386-nocrypto.bin.gz.asc

b) Install the binary.  Execute the following commands as root.
Note that these examples utilizes the FreeBSD 4.7 crypto binary.
Substitute BINARYGZ with the file name which you downloaded in
step (a).

# BINARYGZ=/path/to/sendmail-4.7-i386-crypto.bin.gz
# gunzip ${BINARYGZ}
# install -s -o root -g smmsp -m 2555 ${BINARYGZ%.gz} /usr/libexec/sendmail/sendmail

c) Restart sendmail.  Execute the following command as root.

# /bin/sh /etc/rc.sendmail restart

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

Branch                                                           Revision
  Path
- - -------------------------------------------------------------------------
RELENG_4
  src/contrib/sendmail/FREEBSD-upgrade                           1.1.2.15
  src/contrib/sendmail/PGPKEYS                                1.1.1.1.2.5
  src/contrib/sendmail/RELEASE_NOTES                         1.1.1.3.2.14
  src/contrib/sendmail/cf/README                             1.1.1.3.2.14
  src/contrib/sendmail/cf/cf/submit.cf                        1.1.1.1.2.7
  src/contrib/sendmail/cf/m4/version.m4                      1.1.1.3.2.14
  src/contrib/sendmail/cf/ostype/bsd4.4.m4                        1.3.6.2
  src/contrib/sendmail/contrib/bitdomain.c                        1.2.6.2
  src/contrib/sendmail/doc/op/op.me                          1.1.1.3.2.14
  src/contrib/sendmail/libmilter/comm.c                       1.1.1.1.2.8
  src/contrib/sendmail/libmilter/docs/smfi_setreply.html      1.1.1.1.2.3
  src/contrib/sendmail/libmilter/handler.c                    1.1.1.1.2.6
  src/contrib/sendmail/libmilter/libmilter.h                  1.1.1.1.2.9
  src/contrib/sendmail/libmilter/listener.c                  1.1.1.1.2.11
  src/contrib/sendmail/libmilter/main.c                       1.1.1.1.2.9
  src/contrib/sendmail/libsm/stdio.c                          1.1.1.1.2.4
  src/contrib/sendmail/libsmdb/smdb2.c                        1.1.1.1.2.8
  src/contrib/sendmail/mail.local/mail.local.c                   1.6.6.13
  src/contrib/sendmail/makemap/makemap.c                          1.3.6.6
  src/contrib/sendmail/praliases/praliases.c                      1.3.6.7
  src/contrib/sendmail/smrsh/smrsh.c                             1.3.6.11
  src/contrib/sendmail/src/README                            1.1.1.3.2.13
  src/contrib/sendmail/src/TUNING                             1.1.1.1.2.3
  src/contrib/sendmail/src/conf.c                                1.5.2.13
  src/contrib/sendmail/src/conf.h                                1.6.2.13
  src/contrib/sendmail/src/daemon.c                          1.1.1.3.2.12
  src/contrib/sendmail/src/deliver.c                         1.1.1.3.2.13
  src/contrib/sendmail/src/domain.c                           1.1.1.3.2.8
  src/contrib/sendmail/src/err.c                                  1.3.6.7
  src/contrib/sendmail/src/headers.c                              1.4.2.9
  src/contrib/sendmail/src/main.c                            1.1.1.3.2.14
  src/contrib/sendmail/src/mci.c                                 1.3.6.10
  src/contrib/sendmail/src/milter.c                          1.1.1.1.2.15
  src/contrib/sendmail/src/parseaddr.c                       1.1.1.2.6.12
  src/contrib/sendmail/src/queue.c                           1.1.1.3.2.13
  src/contrib/sendmail/src/savemail.c                            1.4.2.10
  src/contrib/sendmail/src/sendmail.h                        1.1.1.4.2.14
  src/contrib/sendmail/src/srvrsmtp.c                        1.1.1.2.6.13
  src/contrib/sendmail/src/tls.c                              1.1.1.1.2.4
  src/contrib/sendmail/src/version.c                         1.1.1.3.2.14
RELENG_5_0
  src/UPDATING                                                  1.229.2.9
  src/contrib/sendmail/src/daemon.c                          1.1.1.14.2.1
  src/contrib/sendmail/src/headers.c                             1.12.2.1
  src/contrib/sendmail/src/main.c                            1.1.1.15.2.1
  src/contrib/sendmail/src/parseaddr.c                       1.1.1.14.2.1
  src/contrib/sendmail/src/sendmail.h                        1.1.1.17.2.1
  src/sys/conf/newvers.sh                                        1.48.2.5
RELENG_4_7
  src/UPDATING                                              1.73.2.74.2.9
  src/contrib/sendmail/src/daemon.c                      1.1.1.3.2.10.2.1
  src/contrib/sendmail/src/headers.c                          1.4.2.7.2.1
  src/contrib/sendmail/src/main.c                        1.1.1.3.2.12.2.1
  src/contrib/sendmail/src/parseaddr.c                   1.1.1.2.6.10.2.1
  src/contrib/sendmail/src/sendmail.h                    1.1.1.4.2.12.2.1
  src/sys/conf/newvers.sh                                   1.44.2.26.2.9
RELENG_4_6
  src/UPDATING                                             1.73.2.68.2.37
  src/contrib/sendmail/src/daemon.c                       1.1.1.3.2.8.2.1
  src/contrib/sendmail/src/headers.c                          1.4.2.6.2.1
  src/contrib/sendmail/src/main.c                         1.1.1.3.2.9.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.8.2.1
  src/contrib/sendmail/src/sendmail.h                     1.1.1.4.2.9.2.1
  src/sys/conf/newvers.sh                                  1.44.2.23.2.27
RELENG_4_5
  src/UPDATING                                             1.73.2.50.2.41
  src/contrib/sendmail/src/daemon.c                       1.1.1.3.2.6.4.1
  src/contrib/sendmail/src/headers.c                          1.4.2.5.4.1
  src/contrib/sendmail/src/main.c                         1.1.1.3.2.6.4.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.6.4.1
  src/contrib/sendmail/src/sendmail.h                     1.1.1.4.2.7.4.1
  src/sys/conf/newvers.sh                                  1.44.2.20.2.26
RELENG_4_4
  src/UPDATING                                             1.73.2.43.2.40
  src/contrib/sendmail/src/daemon.c                       1.1.1.3.2.6.2.1
  src/contrib/sendmail/src/headers.c                          1.4.2.5.2.1
  src/contrib/sendmail/src/main.c                         1.1.1.3.2.6.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.6.2.1
  src/contrib/sendmail/src/sendmail.h                     1.1.1.4.2.7.2.1
  src/sys/conf/newvers.sh                                  1.44.2.17.2.32
RELENG_4_3
  src/UPDATING                                             1.73.2.28.2.29
  src/contrib/sendmail/src/daemon.c                       1.1.1.3.2.4.2.1
  src/contrib/sendmail/src/headers.c                          1.4.2.4.2.1
  src/contrib/sendmail/src/main.c                         1.1.1.3.2.4.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.4.2.1
  src/contrib/sendmail/src/sendmail.h                     1.1.1.4.2.4.2.1
  src/sys/conf/newvers.sh                                  1.44.2.14.2.20
RELENG_3
  src/contrib/sendmail/src/daemon.c                           1.1.1.2.2.2
  src/contrib/sendmail/src/headers.c                              1.3.2.2
  src/contrib/sendmail/src/main.c                             1.1.1.2.2.2
  src/contrib/sendmail/src/parseaddr.c                        1.1.1.2.2.1
- - -------------------------------------------------------------------------

VII. References

<URL: http://www.kb.cert.org/vuls/id/398025 >
<URL: http://www.iss.net/issEn/delivery/xforce/alerts.jsp?type=Advisories >
<URL: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2002-1337 >
<URL: http://www.sendmail.org/8.12.8.html >
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+ZOcUFdaIBMps37IRAkunAJwO8ydi9lqBz0C7Rx2KQnspXehBkACfVTxs
1uOVHk3rXuMEgmwRoXoEKkA=
=IwY2
- -----END PGP SIGNATURE-----

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

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 use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

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 system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

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-----
Version: 2.6.3i
Charset: noconv
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBPmc1YCh9+71yA2DNAQG2rQQAjpLVRbDYZO87oAmDd7Qr4WJcihhp4j7g
qOE/NtNbXladwdnS7ihjousA+XrqVHsPhR0Ewj1vzWLPVPhW7Dh0N9lStk2YsRFs
NcgFPo9cA8IRkNoefpx8wQzD+d/FMTFqYaEqRmr3yPdtQAGNnLLldi4enBElxx8K
dLNYPaZ6VEs=
=oULR
-----END PGP SIGNATURE-----