Operating System:

Published:

18 March 1999

Protect yourself against future threats.

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

===========================================================================
              AUSCERT External Security Bulletin Redistribution
                             
              ESB-1999.037 -- NetBSD Security Advisory 1999-007
         noexec mount flag is not properly handled by non-root mount
                                19 March 1999

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

The NetBSD Foundation, Inc. has released the following advisory concerning 
the noexec mount flag which is not properly handled by a non-root mount.
This vulnerability may allow local users to execute binaries they're not 
normally allowed to run.


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

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

                 NetBSD Security Advisory 1999-007
                 =================================

Topic:		noexec mount flag is not properly handled by non-root mount
Version:	NetBSD 1.3.3 and prior; NetBSD-current until 19990318
Severity:	Local users can execute binaries they're not allowed to


Abstract
========

On a system where all partitions writable by regular users are mounted with
the `noexec' option, a regular user should not be able to execute a binary
which was not put on the system by the administrator.  Insufficient checks
in the mount system call may allow a regular user to mount a device,
remote host or local directory without the `noexec' option, allowing them
to execute arbitrary binaries.


Technical Details
=================

The mount syscall does not require root privileges, it only requires that
the user has read access to the target and is owner of the mount point.
For such mounts, the `nosuid' and `nodev' flags, which disable set-id
executables and device special files respectively, are automatically handled
by the mount system call, but not the `noexec' flag, which disables the
ability to execute binaries on this partition.  This allows a regular
user to perform a mount on a mount point he owns, and then execute binaries
from this mount point, even if the mount point was initially in a sub-tree
of the global filesystem mounted with the `noexec' option.  The easiest way
to bypass a `noexec' restriction is to use a nullfs mount, but a NFS mount,
or a mount from a readable block device can allow it as well.


Solutions and Workarounds
=========================

A patch is available for the NetBSD 1.3.3 which makes the mount system call
inherit the `noexec' flag from the mount point.  You may find this patch on
the NetBSD ftp server:

    ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/19990317-mount

NetBSD-current since 19990318 is not vulnerable.  Users of NetBSD-current
should upgrade to a source tree later than 19990318.


Thanks To
=========

Manuel Bouyer <bouyer@antioche.lip6.fr> for the solution.


Revision History
================

	1999/03/17 - initial version


More Information
================

Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.


Copyright 1999, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA1999-007.txt,v 1.1 1999/03/18 07:35:55 mrg Exp $

- -----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBNvCxMz5Ru2/4N2IFAQFWkAQAlHWahlMRPWuribmek9zc/incJeGi8OWj
TxxZY2OPMPluEkmOT30xsGtpNZWKaDUv8g1q6X3KBnYsZFonS5RW/AhClSha5nCL
Kx4GiG/9KNK07a06F0G+WjxOrAXSSvh0UyxLbn6E7VJa7/g8h2Uk3osG5SNMkuvj
qTfmCofhnKI=
=TH30
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

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


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

iQCVAwUBNx8IAih9+71yA2DNAQEd5AP9FwZZpYLeWQUvhbL1CAI1/4feXLoLjusz
j+ZQ1lNTNpWC7+OEgwU0OdhvMNuyd0sXs/ZzMN9Z4JS2JQc2jgnxpj4H/QMytD1K
mj3bvCUEJK+aVsIzT2s8ggY8EGMKHwiR0p8n3Yx0HtCJPLREnF3cDEHnWuhVQuir
IeiMv/ZE8sw=
=dHOf
-----END PGP SIGNATURE-----