Summary
Incus can create a privilege-escalation risk when a never-started unprivileged container is rebuilt and then boots without a user namespace. Processes running as root inside that container may retain host-level privileges, potentially allowing kernel module loading and host compromise.
Affected context
The issue concerns Incus container lifecycle handling when an unprivileged container that has never been started is rebuilt. Under this condition, the container may boot without the expected user namespace and without device cgroup restrictions. The risk depends on the container reaching this state and on processes inside it retaining powerful capabilities such as sys_module.
Exploit preconditions
- Attack surface: Incus container creation, rebuild, and startup lifecycle
- Required access: Access sufficient to cause the affected container to be rebuilt and started, or to run processes inside it
- Trigger point: Rebuilding a never-started unprivileged container, followed by boot
- Why exploitation is possible: The container may start without user-namespace isolation, leaving root processes mapped to host UID 0 with powerful capabilities and no device cgroup restriction
Why this happens
The underlying issue is improper privilege management (CWE-269). A lifecycle path for an unprivileged container can fail to preserve the expected user-namespace and device restrictions after a rebuild. As a result, container processes may receive host-level identity and capabilities rather than being confined to the intended privilege boundary.
Potential impact
- A process inside the affected container may run with host UID 0
- An attacker with the required container access could load kernel modules if
sys_moduleremains available - The host kernel and other workloads may be exposed to compromise
- The incident could enable broader disruption or access across the host
General mitigation guidance
Defensive patterns focus on preserving isolation and limiting privileges throughout every container lifecycle transition:
- Ensure unprivileged containers consistently use user namespaces, including after rebuilds
- Apply least-privilege capability sets and drop capabilities such as
sys_modulewhen unnecessary - Enforce device access controls independently of container state
- Validate isolation settings before allowing a container to start
- Restrict who can create, rebuild, or start containers, and run workloads with only the permissions they require
How teams detect issues like this
Detection can combine lifecycle monitoring with configuration and policy checks:
- Review code paths that create, rebuild, or start unprivileged containers for consistent namespace and device-control enforcement
- Use static analysis and code review to flag lifecycle branches that bypass privilege checks or reset isolation settings
- Audit running containers for unexpected host UID mappings, elevated capabilities, or missing device restrictions
- Enforce deployment policies that reject unprivileged containers without the required isolation controls
- Monitor for unexpected kernel module loading and correlate events with container activity

