Users login

Create an account »

JOIN XATRIX

Users login

Home » Hacking News » FreeBSD-SA-02:41-smrsh

FreeBSD-SA-02:41-smrsh

by Nikola Strahija on November 14th, 2002 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


Newsletter signup

Signup to our monthly newsletter and stay in touch with IT news!

Free E-books

We've got ebooks! But they're not online. :( Please give us a few days to bring downloads back.

Contact

Have something to say or just wanna drop us a line? Please keep this in mind: to spam, we reply with spam.

Contact us »