CVE-2025-54287: Canonical LXD Arbitrary File Read via Template Injection in Snapshot Patterns

github.com/lxc/lxd Updated 03 Oct 2025

Summary

02/10/2025
Yes i
High
6.5

CVE-2025-54287: Canonical LXD Arbitrary File Read via Template Injection in Snapshot Patterns. Affects github.com/lxc/lxd across 3 version ranges.

>= 0.0.0-20200331193331-03aab09f5b5c, < 0.0.0-20250827065555-0494f5d47e41 >= 4.0, < 5.21.4 >= 6.0, < 6.5

Fixed in 0.0.0-20250827065555-0494f5d47e41, 5.21.4 or 6.5, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

LXD is a container and virtual machine manager that offers a user-friendly interface for managing Linux containers. It allows users to create, manage, and run containers efficiently. The software utilizes the Pongo2 template engine for generating snapshot names based on user-defined patterns. This functionality, while powerful, has introduced a security vulnerability that can be exploited to read arbitrary files from the host system.

Vulnerability Detail

The vulnerability arises from the use of the Pongo2 template engine in LXD's instance snapshot creation functionality. Specifically, the snapshots.pattern configuration can be manipulated through template injection attacks, allowing an attacker with configuration change permissions to read sensitive files from the host system. This could lead to the exposure of critical information such as LXD host configuration files, database files, and other sensitive data accessible by the LXD process.

How To Fix

Latest published version: v0.0.0-20230707070733-fa595dea7577 as of 23 Oct 2026

go get github.com/lxc/lxd@v0.0.0-20230707070733-fa595dea7577

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 0.0.0-20200331193331-03aab09f5b5c, < 0.0.0-20250827065555-0494f5d47e41 0.0.0-20250827065555-0494f5d47e41
    go get github.com/lxc/lxd@v0.0.0-20250827065555-0494f5d47e41
  • >= 4.0, < 5.21.4 5.21.4
    go get github.com/lxc/lxd@v5.21.4
  • >= 6.0, < 6.5 6.5
    go get github.com/lxc/lxd@v6.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, users can modify the RenderTemplate function in shared/util.go to use a restricted TemplateSet. This can help mitigate the risk of file leakage by banning specific tags and filters that pose a risk of file reading attacks. The following tags should be banned:

  • include
  • ssi
  • extends
  • import

This can be implemented by creating a custom TemplateSet that restricts these functionalities.

Conclusion

CVE-2025-54287 represents a significant security risk for users of Canonical LXD due to its potential for arbitrary file reading through template injection. It is crucial for users to update to the latest patched versions or implement workarounds to mitigate this vulnerability.

See every vulnerability recorded for github.com/lxc/lxd →

Share this vulnerability

FAQ

CVE-2025-54287 is a security vulnerability in Canonical LXD that allows arbitrary file reading through template injection in snapshot patterns.

Any user of LXD versions prior to 5.21.4 and 6.5 who has permissions to modify instance settings is potentially affected.

The risks include unauthorized access to sensitive files on the host system, such as configuration files and database files, which could lead to data leakage.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.

If updating is not possible, implement the suggested workaround by modifying the RenderTemplate function to restrict template functionalities that could lead to file reading.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/lxc/lxd.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: v0.0.0-20230707070733-fa595dea7577 as of 23 Oct 2026

go get github.com/lxc/lxd@v0.0.0-20230707070733-fa595dea7577

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 0.0.0-20200331193331-03aab09f5b5c, < 0.0.0-20250827065555-0494f5d47e41 0.0.0-20250827065555-0494f5d47e41
    go get github.com/lxc/lxd@v0.0.0-20250827065555-0494f5d47e41
  • >= 4.0, < 5.21.4 5.21.4
    go get github.com/lxc/lxd@v5.21.4
  • >= 6.0, < 6.5 6.5
    go get github.com/lxc/lxd@v6.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback