-----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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+ZOcUFdaIBMps37IRAkunAJwO8ydi9lqBz0C7Rx2KQnspXehBkACfVTxs 1uOVHk3rXuMEgmwRoXoEKkA= =IwY2 -----END PGP SIGNATURE-----