GHSA-98vh-x9cx-9cfp Incus is affected by unbounded binary import disk exhaustion
SummaryUploads of large amount of data by authenticated users can run the Incus server out of disk space, potentially taking down the host system.The impact here is limited for anyone using `storage.images_volume` and `storage.backups_volume` as those users will have large uploads be stored on those volumes rather than directly on the host filesystem. This is the default behavior on IncusOS.DetailsMultiple binary import paths accept application/octet-stream requests and stream the HTTP request body directly into temporary files on the host without any visible request-size limit on the upload path.When these endpoints receive binary content, the daemon routes the request body into import routines that create temporary files under daemon-controlled host storage locations and copy the full attacker-controlled stream into them using direct io.Copy operations. This write occurs before the uploaded content is fully parsed and before later validation can reject the import.Because no visible http.MaxBytesReader, io.LimitReader, quota-aware wrapper, or equivalent size-enforcement mechanism is present around these upload paths, an authenticated attacker can supply an arbitrarily large continuous stream of data. This causes the daemon to keep writing unbounded input to host storage until the operation fails or the underlying file system is exhausted. In a multi-tenant deployment, this can be used to consume shared disk space and cause denial of service on the node.The binary import handlers are reachable through application/octet-stream request paths in the instance backup import, storage bucket import, and storage volume import flows, where the request body is passed directly into import helpers handling backup and ISO uploads.Affected File:
https://github.com/lxc/incus/blob/v6.22.0/cmd/incusd/instances_post.goAffected Code:Affected File:
https://github.com/lxc/incus/blob/v6.22.0/cmd/incusd/storage_buckets.goAffected Code:Affected File:
https://github.com/lxc/incus/blob/v6.22.0/cmd/incusd/storage_volumes.goAffected Code:PoCThe following PoC demonstrates one reachable instance of this issue through the instance import endpoint. The same unbounded upload-to-tempfile pattern is also present in storage bucket backup import, storage volume backup import, and storage volume ISO import handlers.Step 1: Trigger the sustained upload streamFrom an Incus client with access to the target server, open a long-lived application/octet-stream upload and continuously stream null bytes into the instance import endpoint. Using timeout 120 limits the reproduction to two minutes while still demonstrating that the daemon keeps writing attacker-controlled input for as long as the connection remains open.Commands:Step 2: Verify host-side disk growth during the uploadOn the Incus host, observe the temporary backup file being actively written under the backups directory while the client keeps the stream open.Command:Result:Step 3: Observe post-stream failure behaviorWhen the client-side timeout expires, the upload is interrupted locally and the stream stops. In this reproduction, that means the process is terminated before any later import-stage error is surfaced back to the client. This does not mitigate the issue during the active upload window, because io.Copy continues writing to disk for as long as the attacker keeps the stream open.It is recommended to enforce a maximum request size or quota-aware upload limit in the affected binary import paths before any data is written to disk. The incoming request body should be wrapped with http.MaxBytesReader, io.LimitReader, or an equivalent quota-aware mechanism so that oversized uploads fail safely before consuming unbounded host storage. By contrast, other upload flows such as image upload appear to use internalIO.NewQuotaWriter(..., budget) when persisting request data, but no analogous quota enforcement is visible in the affected binary import handlers.A patch is available at https://github.com/lxc/incus/releases/tag/v7.0.0.CreditThis issue was discovered and reported by the team at 7asecurity (https://7asecurity.com/)
CVSS v3.1 score: 4.3