/

CVE-2026-16033

Severity:

HIGH RISK

(8.5)

Path Traversal (CWE-22) in LXD QEMU VM Guest Templates

CVE-2026-16033

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary Host File Read and Unconstrained File Creation

Severity:

HIGH RISK

(8.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in LXD allows crafted image archives to cause template paths to escape the intended instance templates directory. In affected virtual machine and QEMU execution paths, an attacker may read arbitrary host files or create files at unintended host locations when malicious image metadata is processed.

Affected context

The issue can arise in LXD deployments that process image metadata templates for virtual machine instances using the QEMU driver. It requires a crafted image archive containing template directives whose paths are not sufficiently constrained to the designated instance templates directory.

Exploit preconditions

  • Attack surface: LXD image import or processing of image metadata templates
  • Required access: Ability to provide or cause LXD to process a crafted image archive
  • Trigger point: Template handling during virtual machine or QEMU instance execution
  • Why exploitation is possible: Template paths containing traversal elements can escape the intended directory when canonicalization and boundary enforcement are incomplete

Why this happens

The underlying bug is improper validation and containment of file paths derived from image metadata. When path components are accepted without reliably resolving and verifying that the resulting path remains beneath the permitted templates directory, attacker-controlled input can redirect file operations elsewhere on the host. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Potential impact

  • An attacker may read sensitive host files
  • An attacker could create or overwrite files outside the intended templates directory
  • Host configuration or runtime integrity may be affected
  • Instance isolation could be weakened
  • File creation may support persistence, denial of service, or follow-on compromise depending on host permissions

General mitigation guidance

Mitigation generally focuses on enforcing a strict filesystem boundary for all template-derived paths.

Common defensive patterns include:

  • Resolve candidate paths before use and verify they remain beneath the permitted directory
  • Reject absolute paths, traversal components, unexpected separators, and symbolic-link escapes
  • Use secure-by-default file APIs that operate relative to a trusted directory where available
  • Treat image archives and metadata as untrusted input until validation is complete
  • Apply strict archive-entry validation and allowlist expected template locations
  • Run LXD and related virtualization processes with the minimum host privileges required
  • Use filesystem permissions and isolation controls to limit the consequences of unintended file access

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules for path construction using archive or image metadata
  • Code review checks for missing canonicalization and directory-boundary validation
  • Tests covering relative paths, absolute paths, encoded traversal, symbolic links, and platform-specific separators
  • Runtime auditing of LXD file access outside approved instance template directories
  • Policy enforcement that restricts accepted archive entries and template locations
  • Automated security review tools that flag untrusted input reaching filesystem APIs

Sources

SourceLink
github.comgithub.com/canonical/lxd/security/advisories/GHSA-9hcm-hxh5-7xxh

Frequently asked

questions

Exploitability depends on how images are supplied to LXD. A remote attacker may be able to trigger the issue if they can upload, publish, or otherwise cause LXD to process a crafted image archive; otherwise, local or administrative access may be required.

The key prerequisite is the ability to provide or influence an image archive that LXD processes. The exact requirement depends on image-management permissions and deployment controls.

Treat image metadata and archive entries as untrusted, resolve paths before file operations, and enforce that every resulting path remains within the intended templates directory.

Use allowlisted archive paths, reject traversal and symlink escapes, test filesystem-boundary conditions, and apply least-privilege permissions to the LXD and virtualization environment.

Find out what's already
exploitable in your codebase.