copyright | disclaimer | privacy | contact  
Australia's Leading Computer Emergency Response Team
 
Search this site

 
On this site

 > HOME
 > About AusCERT
 > Membership
 > Contact Us
 > PKI Services
 > Training
 > Publications
 > Sec. Bulletins
 > Conferences
 > News & Media
 > Services
 > Web Log
 > Site Map
 > Site Help
 > Member login





 

AA-97.02 -- sendmail MIME conversion Buffer Overrun Vulnerability

Date: 30 January 1997

Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----

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

Last Revised:	30 January 1997
		Added vendor information pointer

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

    CERT/CC have also released an advisory on this problem (CA-97.05).
    This advisory contains specific vendor information that was not
    available at the original time of writing this advisory.  To obtain
    this vendor information, sites are encouraged to retrieve CA-97.05
    from:

	ftp://info.cert.org/pub/cert_advisories/CA-97.05.sendmail
	ftp://ftp.auscert.org.au/pub/cert/cert_advisories/CA-97.05.sendmail

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.

- ---------------------------------------------------------------------------
AUSCERT thanks Eric Allman for his rapid response and technical input
essential for the production of this advisory.  Thanks also to DFN-CERT
and CERT/CC for their assistance.
- ---------------------------------------------------------------------------

The AUSCERT team have made every effort to ensure that the information
contained in this document is accurate.  However, the decision to use the
information described is the responsibility of each user or organisation.
The appropriateness of this document for an organisation or individual
system should be considered before application in conjunction with local
policies and procedures.  AUSCERT takes no responsibility for the
consequences of applying the contents of this document.

If you believe that your system has been compromised, contact AUSCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

AUSCERT is located at The University of Queensland within the Prentice
Centre.  AUSCERT is a full member of the Forum of Incident Response and
Security Teams (FIRST).

AUSCERT maintains an anonymous FTP service which is found on:
ftp://ftp.auscert.org.au/pub/.  This archive contains past SERT and AUSCERT
Advisories, and other computer security information.

AUSCERT also maintains a World Wide Web service which is found on:
http://www.auscert.org.au/.

Internet Email: auscert@auscert.org.au
Facsimile:	(07) 3365 4477
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 emergencies.

Postal:
Australian Computer Emergency Response Team
c/- Prentice Centre
The University of Queensland
Brisbane
Qld.  4072.
AUSTRALIA


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Revision History

Jan 30 1997     Added a pointer to CERT advisory CA-97.05 which
		contained specific vendor information not previously
		available.

Jan 22 1997	Advisory was initially released with the incorrect date.
		This was fixed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBMvC2MCh9+71yA2DNAQHIbQP6A/Wk8fX4UuiB8PkqXqfRiwU/E58/vwt4
od0f7ZAXIztI80+Y2WEGon1BO4HsOx3zVP1ke0PnO+Wist2LOFMgBEFUEum/Faw2
AC06vqbJJw7g32T8Ox0jF0YvDDT6EQWWXnAcK2B4e2acs6PEq6AhUnH7y+1ZeyPS
tUB+T02IETs=
=g329
-----END PGP SIGNATURE-----