Canonical LXD Template Injection Vulnerability in Snapshot Creation Component Allowing Arbitrary File Read

Vulnerability

A template injection vulnerability has been identified in the instance snapshot creation component of Canonical LXD versions 4.0 and above. This vulnerability allows an attacker with permissions to modify instance configurations to read arbitrary files from the host system. The issue arises from the use of the Pongo2 template engine in snapshot naming patterns, which, while not allowing code execution, can be exploited to inject templates that read sensitive files.

Impact

Exploitation of this vulnerability could lead to unauthorized access to arbitrary files on the host system, including sensitive LXD configuration and database files, as well as other host files accessible by the LXD process.

Reproduction

To reproduce this vulnerability, log into the LXD-UI with an account that has permission to change instance settings. Inject a template payload into the instance snapshot pattern that uses the Pongo2 template engine's include tag to read system files, bypassing any character count or type restrictions. Once the payload is set, schedule snapshots to run every minute. After waiting for a snapshot to be generated, the injected file contents can be retrieved from the created snapshot name.

Remediation

Users can update to LXD 6.5 or 5.21.4, where this vulnerability has been fixed. For versions 5.0 and 4.0, which are no longer supported, no action is recommended.

Added: Oct 2, 2025, 10:22 AM
Updated: Oct 2, 2025, 2:26 PM

Vulnerability Rating

Custom Algorithm
spread
4.2
impact
3.3
exploitability
4.6
remediation
7.9
relevance
0.6
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.