Skip to main content
Menu
Advisories

Restricted clients can read, replace and destroy other projects' images

GHSA-7RMQ-8P53-99M4Published Updated GitHub

Description

Reported from Incus. This advisory was copied from the Incus advisory GHSA-4j59-4pqh-f3qm.

Image files are stored once per server and shared by every project that holds an image with the same fingerprint. Several code paths trusted that sharing more than they should:

  • Refreshing an image, by request or through the automatic update task, reused another project's image without checking that the owner of the refreshed image may see it, and accepted a partial fingerprint from the image server.
  • A download from an image server claiming to serve an OCI image was not compared with the requested fingerprint, and the fingerprint of an OCI image only covered its layers, not its configuration, nor was it tied to the content that was then fetched.
  • Uploading an image replaced the stored files of an existing image with the same fingerprint, and the same content split differently between metadata and root file system has the same fingerprint.
  • Replacing an image on refresh removed the previous image's files and volumes, and in the update task its records, without looking at the other projects using it.
  • The token handed out for a push mode image upload was also accepted as a download secret, and a token holder could send any form of the image creation request rather than the one upload it was issued for. Those tokens never expired and weren't limited in number.
  • Publishing an instance as a split image read the whole root file system archive into memory.

Impact

A client restricted to a project with restricted=true, where restricted.images.servers is unset, can run an image server of its own and through it:

  • get a copy of any private image of any other project, without knowing its fingerprint, and export it;
  • store content of its choice under the fingerprint of a public image that the server doesn't hold yet, so that other projects, including default, later create instances from the attacker's root file system or with the attacker's entry point and environment while the image record names the genuine source;
  • make another project's image unusable, or have it removed along with its aliases, by refreshing its own copy of the same image.

Without an image server, the same client can break another project's image by uploading the same content split differently, can pin daemon memory with unused upload tokens, and can make the daemon allocate memory matching the size of an instance by publishing it in split format.

A party holding a single image token of a project, typically the remote server on the other side of an image copy, can use it without a client certificate to download that project's private images, add images under new aliases, mark images public and obtain further tokens. Where fine-grained authorization grants image creation without image viewing, that permission alone is enough to download the project's private images.

Workarounds

Setting restricted.images.servers on restricted projects to a list of trusted image servers prevents the attacks that rely on an image server controlled by the client.

There is no workaround for the upload, token and publish issues.

References

GitHub · canonical/lxd