Fine-grained project users on LXD 5.21 can create resources in the default project, bypassing project isolation (host root via raw.dnsmasq)
Description
Reported from Incus. This advisory was copied from the Incus advisory GHSA-jcw9-v2ff-8m79.
On LXD 5.21 LTS (stable-5.21), resource-creation endpoints authorize requests against the requested project rather than the effective project. When a project has a features.* flag disabled (for example the default features.networks=false), the resource is created in the default project instead. A fine-grained authorization (OpenFGA) identity holding a can_create_* entitlement on that project can therefore create resources in default without holding any permissions on default, violating LXD's documented isolation guarantee for fine-grained authorization.
LXD main and stable-6 (6.x) are not affected.
Impact
On LXD 5.21 LTS (stable-5.21), a user authenticated through fine-grained authorization (such as an OIDC or fine-grained TLS identity) with a create entitlement on a project whose matching features.* flag is disabled can create resources in the unrestricted default project:
- Networks (host root). When
features.networks=false(the default for new projects), a user withcan_create_networks(e.g. via theoperatorornetwork_managerrole) on that project can create a bridge network indefaultwithraw.dnsmasq. Theraw.dnsmasqvalue is written verbatim into the dnsmasq configuration and loaded via--conf-file, and setting it skips dnsmasq AppArmor confinement. Settingleasefile-rowithdhcp-script=<path>causes dnsmasq to execute the script asrootat startup without requiring any container or DHCP lease, resulting in full host root compromise. - Other inherited resource types (project isolation bypass). The same effective-project authorization gap exists on the creation endpoints for network ACLs, network zones, profiles, custom storage volumes, storage buckets, images, and image aliases, allowing a fine-grained user to create objects in
defaultwithout holding create permissions ondefault.
(Note: The `block.create_options` and `restricted.storage-pools.access` behaviors mentioned in the upstream Incus advisory do not exist in LXD.)
Affected and unaffected versions
- Affected: LXD 5.21 LTS (
stable-5.21,>= 5.21.0) when using fine-grained authorization (OpenFGA). - Unaffected —
mainandstable-6(6.x): Resource-creation access handlers already resolve the effective project before checking permissions, so fine-grained authorization (OpenFGA) denies creation indefaultunless the caller holds the entitlement ondefault. - Unaffected — restricted TLS certificates (
main,stable-6,stable-5.21,stable-5.0) andstable-4.0: For legacy restricted TLS certificates (without fine-grained authorization), creating, editing, and deleting inherited resources indefaultwhenfeatures.*is disabled is documented behavior — multi-tenant environments not using fine-grained authorization must enable allfeatures.*flags on projects.stable-5.0andstable-4.0do not have OpenFGA fine-grained authorization.
Workarounds
- Enable all relevant
features.*flags (in particularfeatures.networks=true, which also requiresfeatures.profiles=true) on projects used by fine-grained authorization identities, or do not grantcan_create_*entitlements (such ascan_create_networksor theoperatorrole) on projects where the correspondingfeatures.*flag is disabled. - Operators can audit the
defaultproject for unexpected resources created by tenant identities, in particular bridge networks carryingraw.dnsmasq.