Australia's Leading Computer Emergency Response Team

ESB-2008.0854 -- [FreeBSD] -- nmount(2) local arbitrary code execution
Date: 09 September 2008
Original URL: http://www.auscert.org.au/render.html?cid=37&it=9791

Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

                        ESB-2008.0854 -- [FreeBSD]
                 nmount(2) local arbitrary code execution
                             9 September 2008

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

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

Product:              nmount
Publisher:            FreeBSD
Operating System:     FreeBSD
Impact:               Execute Arbitrary Code/Commands
Access:               Existing Account
CVE Names:            CVE-2008-3531

Original Bulletin:    
  http://www.vuxml.org/freebsd/7dbb7197-7b68-11dd-80ba-000bcdf0a03b.html

Revision History:  September 9 2008: Updated Original Bulletin URL
                   September 4 2008: Initial Release

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

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

=============================================================================
FreeBSD-SA-08:08.nmount                                     Security Advisory
                                                          The FreeBSD Project

Topic:          nmount(2) local arbitrary code execution

Category:       core
Module:         sys_kern
Announced:      2008-09-03
Credits:        James Gritton
Affects:        FreeBSD 7.0-RELEASE, FreeBSD 7.0-STABLE
Corrected:      2008-09-03 19:09:47 UTC (RELENG_7, 7.1-PRERELEASE)
                2008-09-03 19:09:47 UTC (RELENG_7_0, 7.0-RELEASE-p4)
CVE Name:       CVE-2008-3531

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:http://security.FreeBSD.org/>.

I.   Background

The mount(2) and nmount(2) system calls are used by various utilities
in the base system to graft a file system object on to the file system
tree to a given mount point.  It is possible to allow unprivileged
users to utililize these system calls by setting the vfs.usermount
sysctl(8) variable.

II.  Problem Description

Various user defined input such as mount points, devices, and mount
options are prepared and passed as arguments to nmount(2) into the
kernel.  Under certain error conditions, user defined data will be
copied into a stack allocated buffer stored in the kernel without
sufficient bounds checking.

III. Impact

If the system is configured to allow unprivileged users to mount file
systems, it is possible for a local adversary to exploit this
vulnerability and execute code in the context of the kernel.

IV.  Workaround

It is possible to work around this issue by allowing only privileged
users to mount file systems by running the following sysctl(8)
command:

# sysctl vfs.usermount=0

V.   Solution

NOTE WELL: Even with this fix allowing users to mount arbitrary media
should not be considered safe.  Most of the file systems in FreeBSD
was not built to protect safeguard against malicious devices.  While
such bugs in file systems are fixed when found, a complete audit has
not been perfomed on the file system code.

Perform one of the following:

1) Upgrade your vulnerable system to 7-STABLE, or to the RELENG_7_0
security branch dated after the correction date.

2) To patch your present system:

The following patches have been verified to apply to FreeBSD 7.0 systems.

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

# fetch http://security.FreeBSD.org/patches/SA-08:08/nmount.patch
# fetch http://security.FreeBSD.org/patches/SA-08:08/nmount.patch.asc

b) Apply the patch.

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

c) Recompile your kernel as described in
<URL:http://www.FreeBSD.org/handbook/kernelconfig.html> and reboot the
system.

VI.  Correction details

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

Branch                                                           Revision
  Path
- - -------------------------------------------------------------------------
RELENG_7
  src/sys/kern/vfs_mount.c                                     1.265.2.10
RELENG_7_0
  src/UPDATING                                              1.507.2.3.2.8
  src/sys/conf/newvers.sh                                    1.72.2.5.2.8
  src/sys/kern/vfs_mount.c                                  1.265.2.1.2.2
- - -------------------------------------------------------------------------

VII. References

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3531

The latest revision of this advisory is available at
http://security.FreeBSD.org/advisories/FreeBSD-SA-08:08.nmount.asc
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFIvu2eFdaIBMps37IRAl9BAJ9Jnp+agN06pBkzPDwEnOT83MNd6QCghOFX
yvNI1gVmhAQ7MXOUvPoLcLk=
=EsCn
- -----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.

NOTE: Third Party Rights
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 follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

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 author's website 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/render.html?cid=1980

If you believe that your computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

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-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBSMYUnSh9+71yA2DNAQKqRwP/Rv5u0Tal5WFVN0RItT1J4MrMICwNmj4r
OFXghhCyhkz1dlsWgmY2XrTX+akhIJC4lrbYuaTpwhwbMFcgmdfW0sCDKpk51D7M
9BMMKDngfsbG+ybWd8EPN/MLWuAQG7ddO4yxuPPey/5HfPNjZcZCTX2rxTNav/1f
DKHcF9fDrkM=
=IQn/
-----END PGP SIGNATURE-----