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

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

                ESB-2003.0228 -- FreeBSD-SA-03:07.sendmail
             a second sendmail header parsing buffer overflow
                               31 March 2003

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

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

Product:                sendmail
Vendor:                 FreeBSD
Operating System:       FreeBSD prior to 4.8-RELEASE and 5.0-RELEASE-p7
                        FreeBSD 4-STABLE prior to 29/03/2003
Impact:                 Root Compromise
                        Denial of Service
Access Required:        Remote
CVE Names:              CAN-2003-0161

Ref:                    AL-2003.05
                        ESB-2003.0227

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

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

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

Topic:          a second sendmail header parsing buffer overflow

Category:       contrib
Module:         contrib_sendmail
Announced:      2003-03-30
Credits:        Michal Zalewski <lcamtuf@ghettot.org>
Affects:        All releases prior to 4.8-RELEASE and 5.0-RELEASE-p7
                FreeBSD 4-STABLE prior to the correction date
Corrected:      2003-03-29 19:34:13 UTC (RELENG_4)
                2003-03-29 21:58:11 UTC (RELENG_5_0)
                2003-03-29 21:58:05 UTC (RELENG_4_7)
                2003-03-29 21:57:58 UTC (RELENG_4_6)
                2003-03-29 21:57:52 UTC (RELENG_4_5)
                2003-03-29 21:57:45 UTC (RELENG_4_4)
                2003-03-29 21:57:36 UTC (RELENG_4_3)
                2003-03-29 20:09:48 UTC (RELENG_3)
FreeBSD only:   NO

I.   Background

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

II.  Problem Description

A buffer overflow that may occur during header parsing was identified.
The overflow is possible due to a programming error involving type
conversions in the C programming language.

NOTE WELL:  This issue is distinct from the issue described in
`FreeBSD-SA-03:04.sendmail', although the impact is very similar.

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 the vulnerability triggered) by the initial
sendmail MTA, by 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 4.8-RELEASE; or
to the RELENG_5_0, RELENG_4_7, or RELENG_4_6 security branch dated
after the correction date (5.0-RELEASE-p7, 4.7-RELEASE-p10, or
4.6.2-RELEASE-p13, respectively).

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:07/sendmail.patch
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:07/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:07/sendmail-4.6-i386-crypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:07/sendmail-4.6-i386-crypto.bin.gz.asc

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

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

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

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

ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:07/sendmail-5.0-i386-nocrypto.bin.gz
ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-03:07/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 name of the file 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.16
  src/contrib/sendmail/RELEASE_NOTES                         1.1.1.3.2.15
  src/contrib/sendmail/cf/README                             1.1.1.3.2.15
  src/contrib/sendmail/cf/cf/submit.cf                        1.1.1.1.2.8
  src/contrib/sendmail/cf/m4/cfhead.m4                            1.3.6.8
  src/contrib/sendmail/cf/m4/proto.m4                        1.1.1.4.2.13
  src/contrib/sendmail/cf/m4/version.m4                      1.1.1.3.2.15
  src/contrib/sendmail/cf/mailer/usenet.m4                    1.1.1.2.6.3
  src/contrib/sendmail/contrib/buildvirtuser                  1.1.1.1.2.5
  src/contrib/sendmail/doc/op/op.me                          1.1.1.3.2.15
  src/contrib/sendmail/editmap/editmap.8                      1.1.1.1.2.2
  src/contrib/sendmail/include/sm/bdb.h                       1.1.1.1.2.2
  src/contrib/sendmail/include/sm/conf.h                      1.1.1.1.2.7
  src/contrib/sendmail/libmilter/docs/api.html                1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/design.html             1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/index.html              1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/installation.html       1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/other.html              1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/overview.html           1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/sample.html             1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/smfi_addheader.html     1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/smfi_addrcpt.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_chgheader.html     1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/smfi_delrcpt.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_getpriv.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_getsymval.html     1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/smfi_main.html          1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_register.html      1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_replacebody.html   1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_setbacklog.html    1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_setconn.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_setpriv.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/smfi_setreply.html      1.1.1.1.2.4
  src/contrib/sendmail/libmilter/docs/smfi_settimeout.html    1.1.1.1.2.3
  src/contrib/sendmail/libmilter/docs/xxfi_abort.html         1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_body.html          1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_close.html         1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_connect.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_envfrom.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_envrcpt.html       1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_eoh.html           1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_eom.html           1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_header.html        1.1.1.1.2.2
  src/contrib/sendmail/libmilter/docs/xxfi_helo.html          1.1.1.1.2.2
  src/contrib/sendmail/libsm/clock.c                          1.1.1.1.2.5
  src/contrib/sendmail/libsm/config.c                         1.1.1.1.2.3
  src/contrib/sendmail/mail.local/mail.local.c                   1.6.6.14
  src/contrib/sendmail/src/README                            1.1.1.3.2.14
  src/contrib/sendmail/src/collect.c                         1.1.1.4.2.12
  src/contrib/sendmail/src/conf.c                                1.5.2.14
  src/contrib/sendmail/src/deliver.c                         1.1.1.3.2.14
  src/contrib/sendmail/src/headers.c                             1.4.2.10
  src/contrib/sendmail/src/main.c                            1.1.1.3.2.15
  src/contrib/sendmail/src/milter.c                          1.1.1.1.2.16
  src/contrib/sendmail/src/parseaddr.c                       1.1.1.2.6.13
  src/contrib/sendmail/src/queue.c                           1.1.1.3.2.14
  src/contrib/sendmail/src/readcf.c                          1.1.1.4.2.14
  src/contrib/sendmail/src/sendmail.h                        1.1.1.4.2.15
  src/contrib/sendmail/src/sm_resolve.c                       1.1.1.1.2.3
  src/contrib/sendmail/src/srvrsmtp.c                        1.1.1.2.6.14
  src/contrib/sendmail/src/tls.c                              1.1.1.1.2.5
  src/contrib/sendmail/src/usersmtp.c                        1.1.1.3.2.12
  src/contrib/sendmail/src/version.c                         1.1.1.3.2.15
RELENG_5_0
  src/UPDATING                                                 1.229.2.13
  src/contrib/sendmail/src/conf.c                                1.18.2.1
  src/contrib/sendmail/src/parseaddr.c                       1.1.1.14.2.2
  src/contrib/sendmail/src/version.c                         1.1.1.16.2.1
  src/sys/conf/newvers.sh                                        1.48.2.8
RELENG_4_7
  src/UPDATING                                             1.73.2.74.2.13
  src/contrib/sendmail/src/conf.c                            1.5.2.11.2.1
  src/contrib/sendmail/src/parseaddr.c                   1.1.1.2.6.10.2.2
  src/contrib/sendmail/src/version.c                     1.1.1.3.2.12.2.1
  src/sys/conf/newvers.sh                                  1.44.2.26.2.12
RELENG_4_6
  src/UPDATING                                             1.73.2.68.2.41
  src/contrib/sendmail/src/conf.c                             1.5.2.8.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.8.2.2
  src/contrib/sendmail/src/version.c                      1.1.1.3.2.9.2.1
  src/sys/conf/newvers.sh                                  1.44.2.23.2.30
RELENG_4_5
  src/UPDATING                                             1.73.2.50.2.43
  src/contrib/sendmail/src/conf.c                             1.5.2.6.4.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.6.4.2
  src/contrib/sendmail/src/version.c                      1.1.1.3.2.7.4.1
  src/sys/conf/newvers.sh                                  1.44.2.20.2.27
RELENG_4_4
  src/UPDATING                                             1.73.2.43.2.43
  src/contrib/sendmail/src/conf.c                             1.5.2.6.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.6.2.2
  src/contrib/sendmail/src/version.c                      1.1.1.3.2.7.2.1
  src/sys/conf/newvers.sh                                  1.44.2.17.2.34
RELENG_4_3
  src/UPDATING                                             1.73.2.28.2.31
  src/contrib/sendmail/src/conf.c                             1.5.2.4.2.1
  src/contrib/sendmail/src/parseaddr.c                    1.1.1.2.6.4.2.2
  src/contrib/sendmail/src/version.c                      1.1.1.3.2.4.2.1
  src/sys/conf/newvers.sh                                  1.44.2.14.2.21
RELENG_3
  src/contrib/sendmail/src/conf.c                                 1.3.2.3
  src/contrib/sendmail/src/parseaddr.c                        1.1.1.2.2.2
  src/contrib/sendmail/src/version.c                          1.1.1.2.2.2
- - -------------------------------------------------------------------------

VII. References

<URL: http://www.cert.org/advisories/CA-2003-12.html >
<URL: http://www.sendmail.com/security/ >
<URL: http://lists.netsys.com/pipermail/full-disclosure/2003-March/008973.html >
<URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2003-0161 >
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+h18lFdaIBMps37IRAg7lAJ9hJLEHlLsXV9Nq20Yw3E3470ZqdQCfX1Sv
BBClV+coK1zwzq/zWcfejME=
=eDvb
- -----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

iQCVAwUBPohsiCh9+71yA2DNAQH2FQP/fEhHIN91wPrZDS3RCtbWcJBPrtdc3lxa
FQ3WRRaFdTbwsSphhb8s+yN73aypQJavsbzvykF1Ki2SabMqlseNkELvDs79KbUE
FkR5VD/tl0jT5TMfIi00UlAOnmARLXQGQp5MNnlC0knraKHSSiFP+5pCC82EZV8W
LlYRr3pQ2SE=
=Ma/p
-----END PGP SIGNATURE-----