Skip to main content
Menu
Advisories

Restricted project users can mount data over any host path through an optimized ZFS import

GHSA-8MQP-3G9Q-46P2Published Updated GitHub

Description

Reported from github.com/lxc/incus/security/advisories/GHSA-992p-fqxp-43w6

Optimized ZFS backups of storage volumes and virtual machines are restored by receiving a ZFS stream. For volumes whose content is a block device, the properties carried in the stream are kept, and nothing checks that a stream declared as block content actually holds one.

A filesystem stream can therefore be imported as if it were a block volume, carrying a mount point of the attacker's choosing. ZFS, running as root, creates the dataset with that mount point and mounts it there straight away. Overlay mounts are the ZFS default, so the directory does not have to be empty for this to take effect.

The mount is re-established every time the pool is imported, including when Incus imports its own pool while starting, so it outlives both a restart of Incus and a reboot of the host.

Impact

A client that can create storage volumes or import instances in a restricted project can mount a filesystem it built itself over any directory on the host, as root. This covers local users reaching Incus through incus-user, which is how most distribution packages expose it, as well as restricted TLS certificates and OIDC or OpenFGA users holding volume or instance entitlements.

That is enough to take over the host. The mount can hide or replace directories the host reads from, such as an administrator's SSH authorized keys, sudo or cron fragments, systemd drop-ins, or another project's instance filesystem. With the ZFS default of setuid=on, a setuid-root binary placed in the mounted filesystem is on its own enough for any local user to become root. The result persists until an administrator notices the dataset and destroys it.

Any deployment with a ZFS storage pool reachable from a restricted project is affected.

Workarounds

Keep restricted projects off ZFS storage pools, or do not allow untrusted users to import volumes or instances. Where imports are not needed, restricted.backups=block on the project removes the route.

References

GitHub · canonical/lxd