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

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

                    ESB-2002.250 -- FreeBSD-SA-02:27.rc
                     rc uses file globbing dangerously
                                30 May 2002

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

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

Product:                rc (/etc/rc)
Vendor:                 FreeBSD
Operating System:       FreeBSD 4.4-RELEASE
                        FreeBSD 4.5-RELEASE
                        FreeBSD 4-STABLE prior to 2002-05-09
Impact:                 Delete Arbitrary Files
Access Required:        Existing Account

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

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

=============================================================================
FreeBSD-SA-02:27.rc                                         Security Advisory
                                                          The FreeBSD Project

Topic:          rc uses file globbing dangerously

Category:       core
Module:         rc
Announced:      XXXX-XX-XX
Credits:        lumpy <lumpy@the.whole.net>
Affects:        FreeBSD 4.4-RELEASE
                FreeBSD 4.5-RELEASE
                FreeBSD 4-STABLE prior to the correction date
Corrected:      2002-05-09 17:39:01 UTC (RELENG_4)
                2002-05-09 17:40:27 UTC (RELENG_4_5)
                2002-05-09 17:41:05 UTC (RELENG_4_4)
FreeBSD only:   YES

I.   Background

rc is the system startup script (/etc/rc).  It is run when the FreeBSD
is booted multi-user, and performs a multitude of tasks to bring the
system up.  One of these tasks is to remove lock files left by X
Windows, as their existence could prevent one from restarting the X
Windows server.

II.  Problem Description

When removing X Windows lock files, rc uses the rm(1) command and
shell globbing:

   rm -f /tmp/.X*-lock /tmp/.X11-unix/*

Since /tmp is a world-writable directory, a user may create
/tmp/.X11-unix as a symbolic link to an arbitrary directory.  The next
time that rc is run (i.e. the next time the system is booted), rc will
then remove all of the files in that directory.

III. Impact

Users may remove the contents of arbitrary directories if the
/tmp/.X11-unix directory does not already exist and the system can
be enticed to reboot (or the user can wait until the next system
maintenance window).

IV.  Workaround

Find and remove or comment-out the following line in /etc/rc:

   rm -f /tmp/.X*-lock /tmp/.X11-unix/*

The following command executed as root will do this:

   /bin/sh -c 'echo -e "/.X11-unix/s/^/#/
w
q
" | /bin/ed -s /etc/rc'

V.   Solution

1) Upgrade your vulnerable system to 4.5-STABLE; or to either of the
RELENG_4_5 (4.5-RELEASE-p6) or RELENG_4_4 (4.4-RELEASE-p13) security
branches dated after the respective correction dates.

2) To patch your present system:

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:27/rc.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:27/rc.patch.asc

b) Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Install the new rc script:

# cd /usr/src/etc
# install -c -o root -g wheel -m 644 rc /etc/rc

VI.  Correction details

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

Path                                                             Revision
  Branch
- - -------------------------------------------------------------------------
src/etc/rc
  RELENG_4                                                     1.212.2.50
  RELENG_4_5                                               1.212.2.38.2.1
  RELENG_4_4                                               1.212.2.34.2.1
- - -------------------------------------------------------------------------

VII. References

<URL:http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/rc?rev=1.312&content-type=text/x-cvsweb-markup>
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iQCVAwUBPPUCJFUuHi5z0oilAQFP6AQArXkMZig8qYFpb38y1oN5BsnqEHFzasTi
pS8emo40Mx9ki4DPRiiLSfzukymVXkjVIcDjKju7qNAxugN4TbZG2AcqZITav0gF
i+vdhUnNf5v2Lp8LwwxtsfNIj2aoikXTTwW9fjJFOmQpDOObNYaSg0bMI+13kcIq
4mTmQs507aI=
=nn/w
- -----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.

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

iQCVAwUBPPYVJyh9+71yA2DNAQHBjgP/dPc/X3CCCum7lNFRqSVYd1eJploqiW0p
DF8mg0CLAxj01/Wtr3meTCiZZMs6k16rdjoNc7c8bedFBoUJWKygGa0Ah8MEfyuJ
hLwn1lXLQfYAVTq656+5qcWpgSSs+AGwk89H3/YTivQfIy31US/eTmSM5Pe9+Z/o
IErydyNN/bg=
=ChQ9
-----END PGP SIGNATURE-----