/

CVE-2026-66898

Severity:

CRITICAL RISK

(9.9)

Path Traversal (CWE-22) in LXD Backup Restore Import

CVE-2026-66898

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized File Access and File Overwrite

Severity:

CRITICAL RISK

(9.9)

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 critical path traversal vulnerability in LXD allows crafted backup archives to influence file system paths during instance or storage volume import and restore operations. If an attacker can provide or cause LXD to process a malicious archive, files outside the intended restore directory may be accessed or overwritten.

Affected context

The vulnerability occurs in LXD backup archive import and restore workflows when archive metadata supplies instance or storage volume names. Risk is present where those names are used to construct file system paths without adequate canonicalization, containment checks, or strict name validation. Exploitation depends on LXD processing an attacker-controlled or tampered backup archive.

Exploit preconditions

  • Attack surface: LXD backup import or restore functionality
  • Required access: Ability to supply, upload, or otherwise cause processing of a crafted backup archive
  • Trigger point: Extraction or restoration of archive contents using instance or storage volume names from archive metadata
  • Why exploitation is possible: Malicious path components can influence destination paths when metadata values are not validated and resolved paths are not constrained to the designated restore directory

Why this happens

The underlying bug is improper neutralization of path elements supplied through backup metadata. LXD uses instance and storage volume names in file system path construction without sufficiently enforcing safe naming rules or verifying that the resolved destination remains within the intended restore root. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An attacker may read files outside the intended restore location
  • Crafted archives could overwrite or corrupt files accessible to the LXD process
  • Instance, storage, or host configuration data could be modified
  • The issue could enable denial of service or disruption of managed workloads
  • File changes could contribute to broader host or container compromise depending on process privileges

General mitigation guidance

Mitigation generally focuses on treating archive metadata as untrusted input and enforcing destination containment.

Common defensive patterns include:

  • Accepting only strictly validated instance and volume names
  • Canonicalizing paths before use and verifying they remain beneath the designated restore directory
  • Rejecting absolute paths, parent-directory components, and unexpected separators
  • Using extraction APIs that enforce trusted destination boundaries
  • Applying least-privilege permissions to LXD and its storage paths
  • Isolating backup processing from sensitive host file systems where practical
  • Preserving defense-in-depth controls such as read-only mounts and filesystem access policies

How teams detect issues like this

Detection can combine source review, runtime monitoring, and policy enforcement:

  • Use static analysis to identify path construction from archive metadata or other external input
  • Review archive extraction code for missing canonicalization and containment checks
  • Flag direct concatenation of user-controlled names with filesystem paths
  • Monitor restore operations for attempts involving parent-directory components, absolute paths, or unusual separators
  • Enforce archive validation policies before extraction and record rejected metadata values
  • Use automated code review or security scanning tools to identify CWE-22 patterns

Sources

SourceLink
github.comgithub.com/canonical/lxd/security/advisories/GHSA-m857-c7gc-c984

Frequently asked

questions

Exploitability depends on deployment and access controls. It may be remotely reachable if an exposed LXD management interface permits an attacker to submit or trigger processing of a crafted backup archive; otherwise, local or administrative access may be required.

The attacker must be able to provide, modify, or cause LXD to process a malicious backup archive. The exact access requirement depends on how backup import and restore operations are authorized.

Treat archive metadata as untrusted, allow only constrained names, canonicalize constructed paths, and verify that every resolved destination remains inside the intended restore directory before any file operation.

Apply secure archive-extraction policies, enforce least privilege, test traversal cases in security-focused test suites, and monitor restore workflows for suspicious path metadata.

Find out what's already
exploitable in your codebase.