Canonical LXD Arbitrary File Read via Template Injection in Snapshot Patterns
CVE-2025-54287 · GHSA-w2hg-2v4p-vmh6
- Affected
- Go github.com/lxc/lxd >= 0.0.0-20200331193331-03aab09f5b5c, < 0.0.0-20250827065555-0494f5d47e41; >= 4.0.0, < 5.21.4; >= 6.0.0, < 6.5.0
- Fixed in
- 6.5.00.0.0-20250827065555-0494f5d47e415.21.4· Vendor fix available
- Issue
- Impact In LXD's instance snapshot creation functionality, the Pongo2 template engine is used in the snapshots.pattern configuration for generating snapshot names. While code execution functionality has not been found in this template engine, it has file reading capabilities, creating a vulnerability that allows arbitrary file reading through template injection attacks. Reproduction Steps 1. Log in to LXD-UI with an account that has permissions to modify instance settings 2. Set the following template injection payload in the instance snapshot pattern: Note that the above template uses the Pongo2 template engine's include tag to read system files. It also uses urlencode and slice filters to bypass character count and type restrictions. 3. Set scheduled snapshots to run every minute and wait for snapshot generation 4. Wait about a minute and confirm that file contents can be obtained from the created snapshot name Risk The attack requires having configuration change permissions for LXD…
Recommended action: Upgrade to 6.5.0, 5.21.4 or 0.0.0-20250827065555-0494f5d47e41 (pre-release) by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.