Skip to main content
Menu
Advisories

Project and per-object authorization bypasses on instances, snapshots and images

GHSA-CWHG-P49M-R95RPublished Updated GitHub

Description

Reported from Incus. This advisory was copied from the Incus advisory GHSA-8553-6xmq-7g3g.

A number of instance, snapshot and image operations name a second object in the request, or reach data that a different entitlement is meant to protect, without the matching permission being checked.

  • A restricted project could be the target of a container live migration in push mode. The runtime state sent by the client was then restored by CRIU as root on the host, and log files found in that state were copied into the instance's log directory, following symbolic links. Containers in restricted projects could also be marked migration.stateful, and a stateful snapshot restore did not require that key.
  • Refreshing an existing instance or custom volume through a copy or migration only required the permission to create instances or volumes in the project, not edit access to the target.
  • Creating or rebuilding an instance from a local image did not check that the caller may view that image.
  • Profiles and custom volumes attached to an instance through an update, and profiles' own devices, were not checked against the caller's permission on those profiles and volumes.
  • Migrating a snapshot only required the permission to manage snapshots.
  • An instance could be restored from a snapshot belonging to another instance.
  • Copying an image that already exists on the server applied the request's public, auto_update and properties to the existing image without requiring edit access to it.
  • The console log of an instance was readable with view access alone.
  • Image uploads could create aliases without the alias creation permission.
  • The instance port forwarding endpoint connected to any address reachable from the instance rather than only to the instance itself.

Impact

The live migration issue affects the default configuration of a restricted project on hosts where CRIU is installed. A client holding a certificate restricted to a project with restricted=true can have the daemon run criu restore as root, outside of any user namespace, on state of its choosing, which is at least equivalent to the privileged containers that restricted projects forbid. The same client can read any file the daemon can read, including the server's private key; on a cluster that key authenticates as a cluster member and so gives full control of the cluster. Without CRIU on the host the request is refused.

A client restricted to a project that uses the images of the default project (features.images=false) can alter the visibility, auto-update setting and properties of every image of the default project, for instance making private images public or making instances created from them fail to start.

The remaining issues affect servers using OpenFGA or an authorization scriptlet to hand out permissions on individual objects. Clients using restricted certificates with the built-in TLS authorization already hold all of those permissions within their projects. On such servers:

  • A client allowed to create instances or volumes in a project can overwrite the root filesystem of any stopped instance, or the content of any custom volume, of that project and remove their snapshots.
  • A client allowed to create instances, or operating a single instance, can obtain the content of every private image of the project.
  • A client allowed to edit one instance can attach, read, modify and delete any custom volume of the project, read the configuration of any of its profiles, and replace its instance with the content and configuration of another instance's snapshot.
  • A client only allowed to manage snapshots can download the full content of the instance or volume.
  • A client with view access can read console output, and consume it before the instance's owner sees it.
  • A client allowed to upload images can publish them under any unused alias, which other users may then deploy from.
  • A client allowed to use port forwarding on an instance, but not to run commands in it, can open connections from that instance to other systems on its networks.

Workarounds

For the live migration issue, do not install CRIU on hosts that serve restricted projects.

For the shared image issue, keep features.images=true (the default) on projects handed to restricted clients.

For the others, there is no configuration-level workaround short of granting OpenFGA or scriptlet permissions at the project level rather than per object. Authorization scriptlets can additionally refuse the affected requests based on the request path and method.

References

GitHub · canonical/lxd