Re: [PATCH v2 1/4] userns: introduce capability bounding set for user namespaces
From: Andy Lutomirski
Date: Thu Nov 19 2026 - 17:52:43 EST
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.
--Andy