GHSA-9C46-V3HW-V6M8
Rebuilding a never-started container makes it boot without a user namespace, running as privileged
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-9C46-V3HW-V6M8 divulgada · CVSS 8.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A container that is rebuilt before it has ever been started boots with no user namespace while its configuration still says it is unprivileged. In-container root is then uid 0 on the host, and because the privileged-container hardening is keyed on the `security.privileged` configuration (not on the actual ID map), none of it is applied. The result is a container the operator believes is unprivileged but which has full host root, retained dangerous capabilities, no device cgroup restriction, `/dev/zfs` exposed, and only the permissive "unprivileged" AppArmor profile.
Details
`incus create` allocates and persists an ID map at create time for an unprivileged instance:
internal/server/instance/drivers/driver_lxc.go:331 lxcCreate sets volatile.idmap.next (and volatile.idmap.base)`volatile.idmap.current` is only written on start, so a never-started instance has `next` but no `current`.
`incus rebuild` resets the map, deleting both the pending map and the on-disk map state:
internal/server/instance/drivers/driver_common.go:750 delete(instLocalConfig, "volatile.idmap.next")
internal/server/instance/drivers/driver_common.go:751 delete(instLocalConfig, "volatile.last_state.idmap")After a rebuild of a never-started instance, all of `next`, `current` and `last_state.idmap` are absent. `NextIdmap()` resolves through a fallback chain that then yields `nil`:
driver_lxc.go:9372 NextIdmap() -> next absent -> CurrentIdmap()
driver_lxc.go:9351 CurrentIdmap() -> current absent -> DiskIdmap()
driver_lxc.go:9360 DiskIdmap() -> last_state absent -> (nil, nil)On first start, the map is only (re)allocated when one already exists:
driver_lxc.go:2124 if nextMap != nil && d.state.OS.IdmapSet != nil && !d.state.OS.IdmapSet.Includes(nextMap) { ... findIdmap ... }With `nextMap == nil` the block is skipped, no map is allocated, and `initLXC` emits no `lxc.idmap` entries (it only does so for a non-nil set, `driver_lxc.go:1096`). The container therefore starts with an identity map.
The hardening is then gated on `IsPrivileged()` (the config), which is false, so:
- `lxc.cap.drop` is not applied (`driver_lxc.go`, under `IsPrivileged()`) — container root keeps `sys_module`, `sys_rawio`, `sys_time`, `mac_admin`/`mac_override`;
- the device cgroup `deny a` is not installed (under `IsPrivileged()`);
- `/dev/zfs` is bind-mounted (the `!IsPrivileged()` branch);
- the "unprivileged" AppArmor profile is selected, which permits `mount` and `pivot_root`.
The state is sticky: the first (unmapped) start writes `volatile.idmap.current` to an empty set, so later starts keep resolving to no map until a config change forces reallocation.
Proof of concept
incus create --empty poc
incus rebuild images:alpine/3.21 poc
incus start poc
# in the container, root is uid 0 on the host with full capabilities:
incus exec poc -- cat /proc/self/status | grep Cap # CapEff/CapBnd = 000001ffffffffff
incus exec poc -- id # uid=0 mapped to host uid 0The trigger is "rebuild before first start"; the `--empty` create is one way to reach it, but any rebuild of a never-started unprivileged instance behaves the same. An instance that was started at least once before rebuild is unaffected (its `volatile.idmap.current` survives and the fallback uses it).
Impact
A container the operator configured as unprivileged runs with no user namespace, i.e. as a privileged container without even the privileged-container hardening. Any root process inside it — the whole point of unprivileged confinement being untrusted workloads — is host root with `sys_module` and raw I/O, so it can load a kernel module or write host devices and fully compromise the host. It is silent: nothing in the config or status indicates the instance is unmapped. Long-standing behavior, not a recent regression.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogithub.com/lxc/incus/v7/cmd/incusd |
Corregida | v7.6.0 | — | — |
v7.6.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/lxc/incus/security/advisories/GHSA-9c46-v3hw-v6m8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
