Skip to main content
Menu
Advisories

Images and instance configuration can inject container runtime configuration and bypass project restrictions

GHSA-CQMV-VJC9-5H35Published Updated GitHub

Description

Reported from Incus. This advisory was copied from the Incus advisory GHSA-mmh3-jfjc-6vc2.

The directory of a container is both its storage volume and the location where liblxc looks for a configuration file of its own. Incus never creates that file, but an image or backup could ship one at the top level of the volume, and liblxc then loaded it as the container's configuration.

Separately, the checks enforcing project restrictions on profile and instance updates looked the object up again by name and silently passed when it was no longer found, so renaming the object around the update skipped the check. Rewriting instances after a custom volume rename or a profile update also wrote back a stale copy of each instance, reverting a concurrent change.

Two configuration values were passed through without validation. The security.syscalls.allow and security.syscalls.deny lists were copied as is into the container's seccomp policy, and volatile.<device>.hwaddr, which restricted projects may set, was written as is into the DHCP host file of the bridge.

Impact

A client able to create a container from an image it provides, including in a project with restricted=true, can have commands run as root on the host when the container starts, bypassing restricted.containers.lowlevel entirely.

A client of a restricted project able to edit a profile can, by winning a race, store raw.lxc and other blocked keys in it, with the same result, or have a protective key such as security.idmap.isolated dropped from an instance. A rename during a snapshot restore crashes the daemon.

Through the syscall lists, a container's policy can make the daemon handle intercepted system calls that were never enabled for it. Through the hardware address, an instance on a shared bridge can add entries to the DHCP server's host file, affecting the addresses handed to other instances on that bridge.

Workarounds

There is no workaround for the image issue other than only letting trusted users create containers, or only allowing virtual machines in untrusted projects (limits.containers=0). The race based issues can be avoided by not giving untrusted users edit access to profiles.

References

GitHub · canonical/lxd