Re: [PATCH v2 1/4] userns: introduce capability bounding set for user namespacesg
From: Jarkko Sakkinen
Date: Mon Nov 23 2026 - 14:35:23 EST
On Mon, Nov 23, 2026 at 09:22:29AM -0800, Casey Schaufler wrote:
> On 11/20/2026 9:09 AM, Andy Lutomirski wrote:
> >> On Nov 19, 2026, at 2:52 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
> >> On Thu, Nov 19, 2026 at 2:43 AM Hallgrimur H. Gunnarsson
> >> <halg@xxxxxxxxxx> wrote:
> >>> When a process creates a new user namespace, it receives a full set of
> >>> capabilities (CAP_FULL_SET) scoped to that namespace. While namespaced
> >>> in scope, several of these capabilities (such as CAP_NET_ADMIN and
> >>> CAP_NET_RAW) expose broad kernel attack surface that many sandboxes and
> >>> containers never need. However, there is currently no configurable way
> >>> to withhold such capabilities from user namespaces while still granting
> >>> them to workloads that require them.
> >>
> >> One thought (from the rootns thread): the other decent sized attack
> >> surface here is CAP_MOUNT_ADMIN. Which doesn't exist as a capability
> >> bit.
> >>
> >> A sort of horrible solution (but maybe not so awful) would be to
> >> declare that the bits in cap_userns aren't actually capability bits,
> >> and that you need the bit in cap_userns *and* the bit in cap_effective
> >> to do sensitive things, and that mounting needs cap_userns to have
> >> NSCAP_MOUNT_ADMIN *and* cap_effective to have CAP_SYS_ADMIN.
> >>
> >> I want to sleep on this. It might actually solve several problems,
> >> e.g. controlling creation of ipv4 and ipv6 loopback or tunnel devices
> >> or whatever.
> > I slept on it. Here’s a counterproposal. I’m not saying I think this
> > is better than this patch set, but I think it’s worth weighting the
> > options.
> >
> > Define a whole new set of privilege bits. As a
> > poorly-painted-bikeshed option, I’ll call them eprivs (for exposure
> > privileges - it’s a crappy name but at least it’s pronounceable).
>
> I played with a mechanism I called "chits" (all the good terms for security
> bits have been consumed for a very long time) that looks a lot like
> what you're proposing. I did it to address the CAP_SYS_ADMIN problem,
> where any use of the capability opens up a whole barrel of worms.
> I cannot, unfortunately, find my patches. :( The basic approach is:
>
> A process has an optional set of chits. A process without a chit set is
> unaffected by the mechanism. A process with a chit set is allowed only
> those operations for which it has a chit. The existing but empty chit set
> allows no operations. A process may drop a chit, but not the set, which,
> again, can be empty.
>
> Because I was after CAP_SYS_ADMIN, I envisioned a call
> cap_able_chit(capability, chit-list)
> but there's no reason there couldn't be a
> chit_able(chit-list)
> as well.
>
> I wrote this as an LSM, but the system-wide aspect of it made that
> a questionable choice.
>
> If you have any interest, I could dig more deeply to try to find the
> patches. Otherwise, I'm happy to look at what you come up with.
What if eprivs or chits would take each capability and subvidide
them into pieces? CAP_MAC_ADMIN would be formally a set of chits
(or eprivs).
And process having e.g., CAP_MAC_ADMIN, would actually have the
set of chits that are included to CAP_MAC_ADMIN.
Without that type of relation there's just a space full of chit
;-)
Br, Jarkko