Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Apr 2014 11:46:00 -0700
From:      Xin Li <delphij@delphij.net>
To:        =?ISO-8859-1?Q?Wout_Decr=E9?= <wout@canodus.be>,  freebsd-security@freebsd.org
Subject:   Re: FreeBSD Security Advisory FreeBSD-SA-14:07.devfs
Message-ID:  <536144E8.4020502@delphij.net>
In-Reply-To: <1398849409.4521.12.camel@debian.wout-t440s>
References:  <201404300435.s3U4ZAfe093748@freefall.freebsd.org> <1398849409.4521.12.camel@debian.wout-t440s>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 04/30/14 02:16, Wout Decré wrote:
> On Wed, 2014-04-30 at 04:35 +0000, FreeBSD Security Advisories
> wrote:
>> =============================================================================
>>
>> 
FreeBSD-SA-14:07.devfs                                      Security
Advisory
>> The FreeBSD Project
>> 
>> Topic:          devfs rules not applied by default for jails
>> 
>> Category:       core Module:         etc_rc.d Announced:
>> 2014-04-30 Affects:        FreeBSD 10.0 Corrected:
>> 2014-04-30 04:03:05 UTC (stable/10, 10.0-STABLE) 2014-04-30
>> 04:04:42 UTC (releng/10.0, 10.0-RELEASE-p2) CVE Name:
>> CVE-2014-3001
>> 
>> 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 device file system, or devfs(5), provides access to kernel's
>> device namespace in the global file system namespace.
>> 
>> The devfs(5) rule subsystem provides a way for the administrator
>> of a system to control the attributes of DEVFS nodes.  Each DEVFS
>> mount-point has a ``ruleset'', or a list of rules, associated
>> with it, allowing the administrator to change the properties,
>> including the visibility, of certain nodes.
>> 
>> II.  Problem Description
>> 
>> The default devfs rulesets are not loaded on boot, even when
>> jails are used. Device nodes will be created in the jail with
>> their normal default access permissions, while most of them
>> should be hidden and inaccessible.
>> 
>> III. Impact
>> 
>> Jailed processes can get access to restricted resources on the
>> host system. For jailed processes running with superuser
>> privileges this implies access to all devices on the system.
>> This level of access could lead to information leakage and
>> privilege escalation.
>> 
>> IV.  Workaround
>> 
>> Systems that do not run jails are not affected.
>> 
>> The system administrator can do the following to load the default
>> ruleset:
>> 
>> /etc/rc.d/devfs onestart
>> 
>> Then apply the default ruleset for jails on a devfs mount using:
>> 
>> devfs -m ${devfs_mountpoint} rule -s 4 applyset
>> 
>> Or, alternatively, the following command will apply the ruleset
>> over all devfs mountpoints except the host one:
>> 
>> mount -t devfs | grep -v '^devfs on /dev ' | awk '{print $3;}' |
>> \ xargs -n 1 -J % devfs -m % rule -s 4 applyset
>> 
>> After this, the system administrator should add the following
>> configuration to /etc/rc.conf to make it permanent, so the above
>> operations do not have to be done each time the host system
>> reboots.
>> 
>> devfs_load_rulesets="YES"
> 
> I have always used the following rc.conf options to start jails:
> 
> jail_xxx_devfs_enable="YES" 
> jail_xxx_devfs_ruleset="devfsrules_jail"
> 
> If jail_xxx_devfs_enable is set to NO, would there be a problem? I 
> thought you always had to set jail_xxx_devfs_ruleset when enabling
> devfs on jails.
> 
> I think this has the same effect as the workaround above?

Assuming the jail have no access to the device file system at all, you
would not be affected by the problem.

Setting jail_*_devfs_ruleset by itself is not sufficient because a
recent change (only in 10.x) have removed the loading of default
rules, making setting the rule set no-op.

No, you don't have to set per-jail ruleset explicitly, the default is
devfsrules_jail unless overridden.

Cheers,
- -- 
Xin LI <delphij@delphij.net>    https://www.delphij.net/
FreeBSD - The Power to Serve!           Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQIcBAEBCgAGBQJTYUToAAoJEJW2GBstM+nsnCEP/RnPDhR+QmvOhbdRwKeuDdcn
SmcDtm+LmJSCxMfkVdDEuskQiI474xfrkGe6+6iIFkjilTU3/0xdKo4eIybp3ARd
osYHJg9zUINIzHh2ez9CR+IqzYS/FD1jWMShhoB/qqWJayclXyz+HdfLCcryOQDn
oYwneuYBRTKLSvViBAbq0pQmfzQX9mmeoSm8rR0lHuOdAfDTNyYKrod7Gku62BHL
2WZmXlgIFVsn+F3k0Ay2eG36D0ZxoAe/gQVhA3VAjSQXsgzWXmUccwpiPqK32mba
gfRVfnC+ARdW0EQxWk258Z5oaAuLWXq2ntaVyr0RjODHXZr2Wi7nDRHSxczDGCrk
yMSdcvHhSOx7dJxRkTashCS+5wwf2yPHChYI7t5XgO2aXukLlOTvM/HHKs0KZiyE
MP1hNjujXu3t6JcIDLcuOogn2YrRYtkprphpjn0W3fN6dOjn2cyjn2o0fRoORerW
ouqaunygcdCxWHUVWJeyql5aTPUJNMPEhkE/xIHNDtwlg9SNVUopMUsHzTN++yMB
QEwMH91p4YaUnllW3u4At6WishkiwObIr6Ygtz7YvJja45F8g5ftRaOUdNNWONse
WHDh/e0sxV6RIGr/yr28h2NVk2Kxqu7bP6XyVIV1F/qtuXkJPYyE5x9/DERreeYw
9sXDbKH7qzj/ANF4kUsY
=bdkk
-----END PGP SIGNATURE-----



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