---
id: CVE-2026-66897
title: >-
  A path traversal vulnerability in LXD's instance template processing allows an
  attacker with container edit permissions, or any user launching a crafted
  image, to overwrite arbitrary files on the host system as root
summary: >-
  A path traversal vulnerability in LXD's instance template processing allows an
  attacker with container edit permissions, or any user launching a crafted
  image, to overwrite arbitrary files on the host system as root. When
  processing targ…
severity: critical
cvss: 9.9
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H'
cwe:
  - CWE-22
  - CWE-23
vendor: canonical
product: lxd
affected:
  - lxd < 4.0.13
  - 'lxd >= 5.0.0, < 5.0.9'
  - 'lxd >= 5.1, < 5.21.7'
  - 'lxd >= 6.0, <= 6.9'
patched:
  - lxd 5.21.7
published: '2026-08-24'
updated: '2026-09-11'
sourceUpdated: '2026-09-11T15:28:53.323'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-66897'
references:
  - url: 'https://github.com/canonical/lxd/security/advisories/GHSA-q39m-8fx9-42fv'
    label: security@ubuntu.com
tags:
  - nvd
  - cve.org
ssvc:
  exploitation: none
  automatable: 'no'
  technicalImpact: total
  timestamp: '2026-08-24T00:00:00+00:00'
ingestedAt: '2026-09-14T11:45:02.856Z'
epss: 0.00717
epssPercentile: 0.51751
---

## Overview

A path traversal vulnerability in LXD's instance template processing allows an attacker with container edit permissions, or any user launching a crafted image, to overwrite arbitrary files on the host system as root. When processing target template paths specified in metadata.yaml, LXD validates the path against a confined os.Root directory handle but subsequently opens and creates the file using os.Create with an unconfined string path. This discrepancy between path resolution checks and file creation allows an attacker to escape directory confinement, overwrite root-owned host files, and achieve host root code execution.

## Affected

- `lxd < 4.0.13`
- `lxd >= 5.0.0, < 5.0.9`
- `lxd >= 5.1, < 5.21.7`
- `lxd >= 6.0, <= 6.9`

## Remediation

Upgrade past the affected range:

- `lxd 5.21.7`
