Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 19:02:25 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        Alexander Leidinger <Alexander@Leidinger.net>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: NFS mount inside jail fails
Message-ID:  <20110518160225.GS48734@deviant.kiev.zoral.com.ua>
In-Reply-To: <20110518140326.GD1867@garage.freebsd.pl>
References:  <1305662200.2633.11.camel@hitfishpass-lx.corp.yahoo.com> <20110517221712.00006e91@unknown> <20110518140326.GD1867@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--zLM+hZtO9R0ndG7f
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 18, 2011 at 04:03:26PM +0200, Pawel Jakub Dawidek wrote:
> On Tue, May 17, 2011 at 10:17:12PM +0200, Alexander Leidinger wrote:
> > On Tue, 17 May 2011 12:56:40 -0700 Sean Bruno <seanbru@yahoo-inc.com>
> > wrote:
> >=20
> > > Silly thing I ran into today.  User wanted to NFS mount a dir inside a
> > > jail.  After I groaned about the security implication of this, I noted
> > > that there is a sysctl that looks like it should allow this.  Namely,
> > > security.jail.mount_allowed.  I noted that setting this follows a path
> > > that *should* have allowed this silly thing to happen, except that the
> > > credentials in the nfsclient were not setup correctly.
> >=20
> > As you noticed, this is supposed to allow to mount inside a jail, IF
> > the FS you want to mount is marked as secure/safe to do so. Nearly no
> > FS is marked as such, as nobody wants to guarantee that it is safe
> > (root in a jail should not be able to panic a system by trying to
> > mount a corrupt/malicious FS-image) and secure (not possible to get
> > elevated access/privileges).
> >=20
> > For NFS there is theoretically the problem that the outgoing address on
> > requests could be the one of the physical host instead of the IP of the
> > jail. If this is true in practice, I do not know. This could be
> > the reason why NFS is not marked with VFCF_JAIL.
>=20
> It is not marked with VFCF_JAIL, because I just had no time to audit
> that it is safe. It might be safe in theory.
>=20
> There are some file systems types that can't be securely mounted within
> a jail no matter what, like UFS, MSDOFS, EXTFS, XFS, REISERFS, NTFS,
> etc.  because the user mounting it has access to raw storage and can
> corrupt it in a way that it will panic entire system.
>=20
> There are other file systems that don't require access to raw storage
> for the user doing the mount and chances are they are safe to mount from
> within a jail, like ZFS (user can have access to ZFS datasets, but don't
> need access to ZFS pool), NFS, SMBFS, NULLFS, UNIONFS, PROCFS, FDESCFS,
> etc. I added VFCF_JAIL flag, so there is general mechanism to mark file
> systems as jail-friendly, but back then I only needed it for ZFS.

If user does nfs or smbfs mount to the local (or any other controllable)
server, then he definitely can plant the DoS or resource starvation
attacks.

--zLM+hZtO9R0ndG7f
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk3T7ZAACgkQC3+MBN1Mb4g7hACgxz27wbgivjXxoIIM+8KlDOU5
H+IAn2slVRmBHe5fJAkBg/yH5g03E3+O
=1Uyz
-----END PGP SIGNATURE-----

--zLM+hZtO9R0ndG7f--



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