CVE-2025-54287
📋 TL;DR
This vulnerability allows attackers with instance configuration permissions in Canonical LXD to perform template injection when creating instance snapshots. Using the Pongo2 template engine, they can read arbitrary files on the host system. This affects LXD versions 4.0 and above.
💻 Affected Systems
- Canonical LXD
📦 What is this software?
Lxd by Canonical
Lxd by Canonical
⚠️ Risk & Real-World Impact
Worst Case
An attacker with instance configuration permissions could read sensitive host system files including configuration files, secrets, and credentials, potentially leading to full host compromise.
Likely Case
Privileged users or compromised accounts with instance configuration permissions can read sensitive files on the host, exposing secrets and configuration data.
If Mitigated
With proper access controls limiting instance configuration permissions to trusted users only, the impact is limited to authorized personnel who already have significant system access.
🎯 Exploit Status
Exploitation requires instance configuration permissions. The vulnerability is well-documented in the security advisory with technical details.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Check latest LXD releases for fix (specific version not provided in advisory)
Vendor Advisory: https://github.com/canonical/lxd/security/advisories/GHSA-w2hg-2v4p-vmh6
Restart Required: No
Instructions:
1. Update LXD to the latest patched version. 2. Follow Canonical's update instructions for your distribution. 3. Verify the fix by checking version and testing snapshot creation with templates.
🔧 Temporary Workarounds
Restrict Instance Configuration Permissions
linuxLimit instance configuration permissions to only trusted, necessary users to reduce attack surface.
# Review and modify LXD user permissions
# lxc config set <instance> security.privileged false
# Restrict user access to instance configuration
Disable Snapshot Template Features
linuxDisable or restrict use of snapshot templates if not required for your use case.
# Monitor and restrict snapshot creation with templates
# Implement policy to disallow custom snapshot patterns
🧯 If You Can't Patch
- Strictly limit instance configuration permissions to minimal necessary users only
- Implement monitoring for unusual snapshot creation patterns and file access attempts
🔍 How to Verify
Check if Vulnerable:
Check if running LXD version 4.0 or higher and if users have instance configuration permissions.
Check Version:
lxd --version
Verify Fix Applied:
After updating, verify the version is patched and test snapshot creation with template patterns to ensure file reading is prevented.
📡 Detection & Monitoring
Log Indicators:
- Unusual snapshot creation patterns
- Template injection attempts in snapshot names/patterns
- Unexpected file read operations from LXD processes
Network Indicators:
- Unusual API calls to snapshot endpoints from unauthorized sources
SIEM Query:
source="lxd" AND (event="snapshot-create" OR event="template-injection") AND pattern="*{{*"