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

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

                  ESB-2002.629 -- FreeBSD-SA-02:41.smrsh
                    smrsh restrictions can be bypassed
                             13 November 2002

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

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

Product:                smrsh (sendmail Restricted Shell command)
Vendor:                 FreeBSD
Operating System:       FreeBSD prior to 4.7-RELEASE
Impact:                 Execute Arbitrary Code/Commands
Access Required:        Existing Account

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

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

=============================================================================
FreeBSD-SA-02:41.smrsh                                      Security Advisory
                                                          The FreeBSD Project

Topic:          smrsh restrictions can be bypassed

Category:       core
Module:         contrib_sendmail
Announced:      2002-11-12
Credits:        zen-parse <zen-parse@gmx.net>,
                Pedram Amini <pamini@idefense.com>,
                iDEFENSE <URL:http://www.idefense.com/>
Affects:        All releases prior to FreeBSD 4.7-RELEASE
Corrected:      2002-10-08 00:53:31 UTC (RELENG_4)
                2002-10-08 00:57:20 UTC (RELENG_4_7)
                2002-10-26 21:11:30 UTC (RELENG_4_6)
                2002-10-26 21:10:59 UTC (RELENG_4_5)
                2002-10-26 21:10:22 UTC (RELENG_4_4)
                2002-10-26 21:08:42 UTC (RELENG_4_3)
FreeBSD only:   NO

I.   Background

The sendmail Restricted Shell command (smrsh) is intended as a
replacement for the system shell (/bin/sh) for use by sendmail.  It
limits the set of programs that can be executed through sendmail to
those in a single directory, and limits shell built-in commands.

II.  Problem Description

Errors in smrsh's handling of command arguments with "||" or spaces
may allow the execution of commands outside of those in its target
directory.  Since command arguments may be specified in local users'
`.forward' files, the smrsh restrictions may be bypassed using such
files that are specially crafted.

III. Impact

Users with a local account and the ability to create or modify their
`.forward' files can circumvent the smrsh restrictions.  This is
mostly of consequence to systems which have local users that are not
normally allowed access to a login shell, as such users may abuse this
bug in order to execute arbitrary commands with normal privileges.

IV.  Workaround

There is no known workaround, short of disabling `.forward' files.  To
do so, add the following line to the sendmail.mc file, regenerate the
sendmail.cf configuration file, and restart sendmail.

   define(`confFORWARD_PATH', `')dnl

V.   Solution

1) Upgrade your vulnerable system to 4.7-STABLE; or to the RELENG_4_7,
RELENG_4_6, RELENG_4_5, RELENG_4_4, or RELENG_4_3 security branch
dated after the correction date.

2) To patch your present system:

The following patch has been verified to apply to FreeBSD 4.4, FreeBSD
4.5, and FreeBSD 4.6 systems.

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

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:41/smrsh.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:41/smrsh.patch.asc

b) Execute the following commands as root:

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

VI.  Correction details

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

Path                                                             Revision
  Branch
- - -------------------------------------------------------------------------
src/contrib/sendmail/smrsh/smrsh.c
  RELENG_4                                                        1.3.6.9
  RELENG_4_7                                                  1.3.6.8.2.1
  RELENG_4_6                                                  1.3.6.6.2.1
  RELENG_4_5                                                  1.3.6.5.4.1
  RELENG_4_4                                                  1.3.6.5.2.1
  RELENG_4_3                                                  1.3.6.4.2.1
- - -------------------------------------------------------------------------

VII. References

<URL:http://www.idefense.com/advisory/10.01.02.txt>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iQCVAwUBPdFKAFUuHi5z0oilAQEgVAP9F8EqcCR0MBXgrNr8LaC3RS9T0yZOL8pn
wRdhi/CJrl+xXkh3PeK1t4CNnSzDjQRTCAoiguisbzxUb1ww9BYkYBrsX7/U9bOT
ZTcRb23nKTLZvWhpocGLNW6tLr7TwM+6QoklHxW7TDw1pdyxdNFRk3w5eAGBc/wJ
ZM+hFGmapmA=
=UMny
- -----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 original authors 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/Information/advisories.html

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: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBPdJ4KSh9+71yA2DNAQGZLgP/bRroCG+OhKG2UHFmT3WStaDPGU5KrMNZ
4NQVCTQa68HU9tegoZgMRi7al/2i66rKNf/wcC67I2174LQ9vCbLzz/qQszwtHp1
syMJSMDi44bn/GjS7rNqQEQdRPKma/FdsGDqXPQLya0ibhgSEdPCch5GkZAREZzB
+F4rfK2USKw=
=50sl
-----END PGP SIGNATURE-----