Summary
A path traversal and unsafe symlink-handling vulnerability in Incus allows an authenticated user to use a malicious instance image to redirect metadata operations to arbitrary paths on the host.
Depending on permissions and the targeted file, this may allow reading or overwriting host files with root-level impact.
Affected context
The issue affects Incus deployments that process instance images containing a malicious metadata.yaml symlink and expose the instance metadata API to authenticated users. It becomes risky when metadata handling follows links without validating that the resolved path remains within the intended instance or image directory. The exposure depends on image import controls, user permissions, API availability, and host filesystem protections.
Exploit preconditions
- Attack surface: Incus instance metadata processing and its metadata API
- Required access: An authenticated Incus account with sufficient permissions to use or deploy a crafted image
- Trigger point: Metadata operations involving the
metadata.yamlpath - Required condition: The image contains a symlink that resolves outside the expected metadata directory
- Why exploitation is possible: The affected path is not consistently confined or rejected before file access, allowing host paths to be treated as instance metadata
Why this happens
The underlying flaw is insufficient validation of symbolic links and resolved filesystem paths during metadata handling. A path supplied through an image can reference a location outside the intended trust boundary, and file operations may then follow that link with the privileges of the Incus service.
This maps to CWE-73: External Control of File Name or Path, because attacker-influenced filesystem references are used without reliably enforcing confinement to an approved root. The insecure pattern is trusting a logical metadata path without validating its link target and canonical location before reading or writing.
Potential impact
- An attacker may read sensitive files from the host
- An attacker may overwrite host files or configuration
- The Incus service may be abused to perform file operations with root privileges
- Host integrity, availability, or confidentiality could be compromised
- The issue could enable container escape or broader control of managed workloads
General mitigation guidance
Mitigation generally focuses on enforcing filesystem confinement and treating image contents as untrusted input.
Common defensive patterns include:
- Rejecting symbolic links for metadata paths unless their targets are explicitly approved
- Resolving and validating canonical paths before every read or write operation
- Confining file access to a dedicated root using operating-system-supported root handles or equivalent mechanisms
- Applying the same validation consistently across metadata, template, and execution-related paths
- Restricting which users can import images or create instances from untrusted images
- Running management services with the minimum filesystem and host privileges necessary
- Using read-only and integrity-protected host paths where practical
How teams detect issues like this
Organizations can look for this vulnerability through:
- Static analysis rules that flag file operations on attacker-controlled paths without symlink or root confinement checks
- Code review signals such as direct path joins followed by open, copy, rename, or write operations
- Tests that include symlinked metadata entries pointing inside and outside the permitted root
- Policy checks requiring canonical-path validation or safe root-scoped file APIs
- Runtime monitoring for unexpected Incus access to sensitive host paths
- Audit review of image imports, instance creation, and metadata API activity by authenticated users
Automated security scanners and code-review tools may help identify unsafe path handling, but filesystem-boundary tests remain important for validating actual behavior.

