TUCoPS :: Unix :: General :: ciach023.txt

Sendmail Mime Buffer Overrun Vulnerability

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





             __________________________________________________________

                       The U.S. Department of Energy
                    Computer Incident Advisory Capability
                           ___  __ __    _     ___
                          /       |     /_\   /
                          \___  __|__  /   \  \___
             __________________________________________________________

                             INFORMATION BULLETIN

             sendmail MIME Conversion Buffer Overrun Vulnerability

January 23, 1997 16:00 GMT                                         Number H-23
______________________________________________________________________________
PROBLEM:       Due to insufficient bounds checking while performing limited 7 
               to 8 bit MIME conversions on email messages, it is possible to 
               overwrite the internal stack space of sendmail while it is 
               executing with root privileges. 
PLATFORM:      Sendmail versions 8.8.3 and 8.8.4 
DAMAGE:        Remote users can obtain root access and exploit this vulnerability
    	       regardless of the presence of firewalls or other network
	       boundary protective measures.
SOLUTION:      Upgrade to new version of sendmail (8.8.5) or use workarounds 
               as outlined in Section 3. 
______________________________________________________________________________
VULNERABILITY  Exploit details involving this vulnerability have been made 
ASSESSMENT:    publicly available. 
______________________________________________________________________________

[ Start AUSCERT Advisory ]

===========================================================================
AA-97.02                        AUSCERT Advisory
              sendmail MIME conversion Buffer Overrun Vulnerability
                                 22 January 1997

Last Revised:	22 January 1997
		Fixed release date.

- - ---------------------------------------------------------------------------
AUSCERT has received information that sendmail Versions 8.8.3 and 8.8.4
contain a serious security vulnerability.  This vulnerability may allow
remote users to execute arbitrary commands with root privileges.  This
vulnerability may be exploited on systems despite the presence of firewalls
or other network boundary protective measures.

AUSCERT recommends that sites take the steps outlined in Section 3
as soon as possible.
- - ---------------------------------------------------------------------------

1.  Description

    A serious security vulnerability in sendmail Versions 8.8.3 and 8.8.4
    has been discovered that allows remote users to execute arbitrary
    commands with root privileges.  

    As part of its functionality, sendmail is able to perform limited 7
    to 8 bit MIME conversions on email messages.  Due to insufficient
    bounds checking while performing these conversions, it is possible to
    overwrite the internal stack space of sendmail while it is executing
    with root privileges.

    By sending a carefully crafted email message to a system running a
    vulnerable version of sendmail, intruders may be able to force sendmail
    to execute arbitrary commands with root privileges.

    In most cases, the MIME conversion of email is done on final delivery;
    that is, to the local mailbox or a program.  Therefore this
    vulnerability may be exploited on systems despite the presence of
    firewalls and other network boundary protective measures.

    Systems are vulnerable to this attack if both of the following
    conditions are true:

    A.  The version of sendmail is 8.8.3 or 8.8.4.  

	To determine the version of sendmail, use the following command:

		% sendmail -d0 -bt < /dev/null | grep -i Version

	If the string returned is "Version 8.8.3" or "Version 8.8.4", then
	this version of sendmail is vulnerable.

    B.  sendmail is configured to perform 7 to 8 bit MIME conversions.
	
	sendmail will perform 7 to 8 bit MIME conversions when the '9'
	flag is set as part of any Mailer specification in sendmail's
	configuration file.

	Examine the sendmail configuration file (usually, /etc/sendmail.cf).
	If the '9' flag is set in the "F=" (Flags) section for any Mailer
	specifications (sections starting with 'M' in the first column,
	such as "Mprog" or "Mlocal"), then this configuration is
	vulnerable.  Use of the '9' flag can usually be determined using
	the following command (depending on your sendmail configuration):

        % grep '^M' /etc/sendmail.cf | grep 'F=[^,]*9'

	If any lines are displayed with this command, then the sendmail
	configuration may be vulnerable.

    The '9' flag is set by default when the sendmail.cf file is generated
    using the m4 files distributed with sendmail 8.8.x.  Versions of
    sendmail prior to 8.8.0 did not set this flag by default when
    generating sendmail.cf.  The '9' flag is also set by default in the
    precompiled example configuration files found in the cf/cf/obj/
    subdirectory of the sendmail Version 8.8.x distribution.

    Although this vulnerability is similar to that described in AUSCERT
    Advisory AA-96.06a, it represents a new problem.

    Versions of sendmail prior to 8.8.3 contain other security
    vulnerabilities.  AUSCERT encourages sites using those versions to
    upgrade to the current version of sendmail.

2.  Impact

    Remote users may gain root privileges on systems using version 8.8.3 or
    8.8.4 of sendmail that performs 7 to 8 bit conversion.  

3.  Workarounds/Solution

    AUSCERT recommends that sites upgrade to the current version of
    sendmail (Section 3.1).  For sites that can not install the current
    version of sendmail, apply the workaround described in Section 3.2.

3.1 Upgrade to the current sendmail version

    Eric Allman has released a new version of sendmail (8.8.5) which fixes
    this vulnerability.  This can be obtained from the following locations:

        ftp://ftp.sendmail.org/pub/sendmail/
        ftp://ftp.cs.berkeley.edu/ucb/src/sendmail/
        ftp://ftp.auscert.org.au/pub/mirrors/ftp.cs.berkeley.edu/ucb/sendmail/
        ftp://ftp.cert.dfn.de/pub/tools/net/sendmail/
        ftp://ftp.cert.org/pub/tools/sendmail/

    The MD5 checksum for this distribution is:

        MD5 (sendmail.8.8.5.tar.gz) = 7c32c42a91325dd00b8518e90c26cffa
	MD5 (sendmail.8.8.5.tar.Z)  = 7b847383899c0eb65987213a5caf89c8
	MD5 (sendmail.8.8.5.patch)  = 775c47d16d40ebd2b917dfcc65d92e90

    The .Z file has the same contents as the .gz file, but is compressed
    using UNIX compress instead of gzip.  A .sig file is also contained
    in the distribution.  This is Eric Allman's PGP signature for the
    uncompressed tar file.  The key fingerprint is

    Type bits/keyID    Date       User ID
    pub  1024/BF7BA421 1995/02/23 Eric P. Allman <eric@CS.Berkeley.EDU>
      Key fingerprint =  C0 28 E6 7B 13 5B 29 02  6F 7E 43 3A 48 4F 45 29
				Eric P. Allman <eric@Reference.COM>
				Eric P. Allman <eric@Usenix.ORG>
				Eric P. Allman <eric@Sendmail.ORG>
				Eric P. Allman <eric@CS.Berkeley.EDU>

    When changing to a new version of sendmail, it is strongly recommended
    that the configuration files are updated with those of the new version.
    Significant work has been done to make this task easier.  (Note it is
    highly likely that older configuration files will not work correctly
    with sendmail version 8.)  It is now possible to build a sendmail
    configuration file (sendmail.cf) using the configuration files provided
    with the sendmail release.  Consult the cf/README file for a more
    complete explanation.  Creating your configuration files using this
    method makes it easier to incorporate future changes to sendmail into
    your configuration files.

3.2 Workaround for existing sendmail Version 8.8.3 and 8.8.4 installations.

    Eric Allman, the author of sendmail, has provided the following
    workaround.

    Since the vulnerability occurs in the 7 to 8 bit conversion code, the
    problem described in this advisory can be avoided by disabling this
    functionality.  This can be done by removing the F=9 flag from all
    Mailer specifications in the sendmail.cf file.

    For example, a sendmail.cf file with these changes applied should look
    similar to (depending on your system and configuration):

Mlocal,    P=/usr/libexec/mail.local, F=lsDFMAw5:/|@qrmn, S=10/30, R=20/40,
           T=DNS/RFC822/X-Unix,
           A=mail -d $u
Mprog,     P=/bin/sh, F=lsDFMoqeu, S=10/30, R=20/40,
           D=$z:/,
           T=X-Unix,
           A=sh -c $u

    This can be achieved for the "Mlocal" and "Mprog" Mailers by modifying
    the ".mc" file to include the following lines:

		define(`LOCAL_MAILER_FLAGS',
			ifdef(`LOCAL_MAILER_FLAGS',
				`translit(LOCAL_MAILER_FLAGS, `9')',
				`rmn'))
		define(`LOCAL_SHELL_FLAGS',
			ifdef(`LOCAL_SHELL_FLAGS',
				`translit(LOCAL_SHELL_FLAGS, `9')',
				`eu'))

    and then rebuilding the sendmail.cf file using m4(1).

    NOTE: 
    The defines of LOCAL_MAILER_FLAGS and LOCAL_SHELL_FLAGS should be
    placed in your m4(1) input file *after* the operating system is
    identified using the OSTYPE directive, and after any other defines of
    either the LOCAL_MAILER_FLAGS or LOCAL_SHELL_FLAGS.

    It is possible to directly edit the sendmail.cf file to resolve this
    vulnerability.  However, caution must be taken to ensure that the
    sendmail.cf file is not replaced in the future with a new version
    rebuilt from configuration files that include the '9' flag.

    Once the configuration file has been modified, all running versions
    of sendmail should be killed and the sendmail daemon restarted:

    	kill -1 `head -1 /var/run/sendmail.pid`

    (The pathname may be different on your system.)  Verify that a new
    daemon was started using "(echo quit; sleep 1) | telnet localhost 25".
    Alternatively, reboot your system.

===========================================================================
[ End AUSCERT Advisory ]
_______________________________________________________________________________

CIAC wishes to acknowledge the contributions of AUSCERT, Eric Allman, DFN-CERT,
and CERT/CC for the information contained in this bulletin.
_______________________________________________________________________________


CIAC, the Computer Incident Advisory Capability, is the computer
security incident response team for the U.S. Department of Energy
(DOE) and the emergency backup response team for the National
Institutes of Health (NIH). CIAC is located at the Lawrence Livermore
National Laboratory in Livermore, California. CIAC is also a founding
member of FIRST, the Forum of Incident Response and Security Teams, a
global organization established to foster cooperation and coordination
among computer security teams worldwide.

CIAC services are available to DOE, DOE contractors, and the NIH. CIAC
can be contacted at:
    Voice:    +1 510-422-8193
    FAX:      +1 510-423-8002
    STU-III:  +1 510-423-2604
    E-mail:   ciac@llnl.gov

For emergencies and off-hour assistance, DOE, DOE contractor sites,
and the NIH may contact CIAC 24-hours a day. During off hours (5PM -
8AM PST), call the CIAC voice number 510-422-8193 and leave a message,
or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two
Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC
duty person, and the secondary PIN number, 8550074 is for the CIAC
Project Leader.

Previous CIAC notices, anti-virus software, and other information are
available from the CIAC Computer Security Archive.

   World Wide Web:      http://ciac.llnl.gov/
   Anonymous FTP:       ciac.llnl.gov (128.115.19.53)
   Modem access:        +1 (510) 423-4753 (28.8K baud)
                        +1 (510) 423-3331 (28.8K baud)

CIAC has several self-subscribing mailing lists for electronic
publications:
1. CIAC-BULLETIN for Advisories, highest priority - time critical
   information and Bulletins, important computer security information;
2. CIAC-NOTES for Notes, a collection of computer security articles;
3. SPI-ANNOUNCE for official news about Security Profile Inspector
   (SPI) software updates, new features, distribution and
   availability;
4. SPI-NOTES, for discussion of problems and solutions regarding the
   use of SPI products.

Our mailing lists are managed by a public domain software package
called ListProcessor, which ignores E-mail header subject lines. To
subscribe (add yourself) to one of our mailing lists, send the
following request as the E-mail message body, substituting
CIAC-BULLETIN, CIAC-NOTES, SPI-ANNOUNCE or SPI-NOTES for list-name and
valid information for LastName FirstName and PhoneNumber when sending

E-mail to       ciac-listproc@llnl.gov:
        subscribe list-name LastName, FirstName PhoneNumber
  e.g., subscribe ciac-notes OHara, Scarlett W. 404-555-1212 x36

You will receive an acknowledgment containing address, initial PIN,
and information on how to change either of them, cancel your
subscription, or get help.

PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing
communities receive CIAC bulletins.  If you are not part of these
communities, please contact your agency's response team to report
incidents. Your agency's team will coordinate with CIAC. The Forum of
Incident Response and Security Teams (FIRST) is a world-wide
organization. A list of FIRST member organizations and their
constituencies can be obtained via WWW at http://www.first.org/.

This document was prepared as an account of work sponsored by an
agency of the United States Government. Neither the United States
Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any
legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process
disclosed, or represents that its use would not infringe privately
owned rights. Reference herein to any specific commercial products,
process, or service by trade name, trademark, manufacturer, or
otherwise, does not necessarily constitute or imply its endorsement,
recommendation or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.

LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC)

H-14: SGI IRIX Vulnerabilities (systour, OutOfBox, cdplayer, datman)
H-15: Korn Shell (ksh) suid_exec Vulnerability
H-16: HP-UX Security Vulnerabilities (chfn, Remote Watch)
H-06a: Sun libc/libnsl vulnerabilities (Sun Bulletin #00137a)
H-17: cron/crontab Buffer Overrun Vulnerabilities
H-18: Denial-of-Service Attack via ping
H-19: HP Software Installation Programs Vulnerability
H-20: Vulnerability in IRIX csetup
H-21: HP Security Vulnerabilities (newgrp, authentication, passwor
H-22: talkd Buffer Overrun Vulnerability

RECENT CIAC NOTES ISSUED (Previous Notes available from CIAC)

Notes 07 - 3/29/95     A comprehensive review of SATAN

Notes 08 - 4/4/95      A Courtney update

Notes 09 - 4/24/95     More on the "Good Times" virus urban legend

Notes 10 - 6/16/95     PKZ300B Trojan, Logdaemon/FreeBSD, vulnerability
                       in S/Key, EBOLA Virus Hoax, and Caibua Virus

Notes 11 - 7/31/95     Virus Update, Hats Off to Administrators,
                       America On-Line Virus Scare, SPI 3.2.2 Released, 
                       The Die_Hard Virus

Notes 12 - 9/12/95     Securely configuring Public Telnet Services, X
                       Windows, beta release of Merlin, Microsoft Word
                       Macro Viruses, Allegations of Inappropriate Data
                       Collection in Win95

Notes 96-01 - 3/18/96  Java and JavaScript Vulnerabilities, FIRST
                       Conference Announcement, Security and Web Search
                       Engines, Microsoft Word Macro Virus Update


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMxtcgLnzJzdsy3QZAQHSYAP+IfHcTmreqZF8bAZ3rRxhbZ9IhLD/koEb
+sI0v0EOSCNyp0xKrO5ZRufXWYwWOGSD5BX5JMxnEk2QwMRBv4FqiUoIzNh+Ybb/
fG2muXCUaDdcdX4byx5ETqSEXHFoQOYsgxGMo2R9Aul1iIKF2SvBO0CIJxu0BMw/
M/naTxKvz5s=
=8t1G
-----END PGP SIGNATURE-----

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH