Summary
Incus can accept unvalidated snapshot names from a custom-volume backup index, allowing traversal sequences to refer to paths outside the intended volume area. If a user permitted to import custom volumes supplies a crafted backup and a later operation processes its snapshot names, privileged deletion, renaming, or mounting may affect arbitrary host paths.
Affected context
The issue concerns Incus custom-volume imports that use snapshot names from a backup's index configuration. It becomes risky when those names are accepted without adequate path validation and later used by privileged deletion, rename, or mount operations.
Exploit preconditions
- Attack surface: Custom-volume backup import and subsequent snapshot operations
- Required access: Permission to import custom volumes
- Trigger point: A later deletion, rename, or mount operation processes the imported snapshot names
- Why exploitation is possible: Unvalidated traversal sequences can cause privileged filesystem operations to resolve paths outside the intended volume location
Why this happens
The underlying bug is improper limitation of a user-controlled path to an expected directory. Snapshot names from the backup index are accepted without sufficient validation, then used in filesystem operations with elevated privileges. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- Privileged deletion could remove host directories or their contents
- Rename operations could alter paths outside the intended volume area
- Mount operations could act on unintended host paths
- Incus host integrity or availability could be compromised
General mitigation guidance
Defensive patterns focus on ensuring every filesystem operation remains confined to its intended directory.
- Treat imported snapshot names as untrusted and reject path separators, traversal components, and unexpected name formats.
- Resolve and verify paths against a trusted base directory before performing filesystem operations.
- Use APIs and designs that operate on directory handles or otherwise enforce directory boundaries.
- Apply least privilege to services and operations handling imported backups, and limit who can import custom volumes.
- Prefer secure-by-default import workflows that validate backup metadata before storing or acting on it.
How teams detect issues like this
- Use static analysis to identify filesystem operations that consume imported names or other user-controlled path components.
- Review import, deletion, rename, and mount code for canonicalization and containment checks performed before privileged operations.
- Enforce policies requiring validation of backup metadata and path containment checks in code review and CI.
- Monitor audit events for unexpected filesystem changes associated with custom-volume operations.

