Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 1999 11:22:44 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Philippe CASIDY <pcasidy@worldnet.fr>
Cc:        gjb@comkey.com.au, freebsd-questions@FreeBSD.ORG
Subject:   Re: Mounting CDROM (or removable media) by users
Message-ID:  <19990210112243.A47243@dan.emsphone.com>
In-Reply-To: <199902101635.RAA03064@greatoak.home>; from "Philippe CASIDY" on Wed Feb 10 17:35:55 GMT 1999
References:  <19990210001221.19077.qmail@alpha.comkey.com.au> <199902101635.RAA03064@greatoak.home>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 10), Philippe CASIDY said:
> You example is not very revelant because you are comparing two
> different system and it is very easy to find a workaround. Anyway, I
> like the sudo feature because as far as I understand, you can easily
> choose who can or cannot mount a device.
> 
> I just want to know what is the technical reason why by default, only
> root can mount the cdrom.

Because an unscrupulous user could insert a CDrom with a setuid-root sh
binary and become root, or they could create a character device with
[major,minor] of [2,1] (i.e. /dev/kmem) with world-write permissions,
and become root by twiddling the kernel memory.  Or they could insert a
cdrom/floppy with an intentionally invalid filesystem on it and panic
the system.  If you limit mount() access to people who are already
root, this isn't a problem.

You could alter the mount() syscall to force "noexec, nosuid, nodev"
whenever a non-root user tries to mount anything, but don't come
running to us when he goes and mounts a cdrom on top of /bin or /tmp or
something :)

The best solution to the "user wants to mount a floppy/cdrom" problem
is make a sudo wrapper that mounts a device in a predetermined place,
with the noexec, nosuid, and nodev flags turned on, and provide a
separate wrapper for unmounting.

	-Dan Nelson
	dnelson@emsphone.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990210112243.A47243>