CVE-2025-54287

6.5 MEDIUM

📋 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

Products:
  • Canonical LXD
Versions: >= 4.0
Operating Systems: Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects users with instance configuration permissions. The vulnerability is present in default configurations when using snapshot creation with templates.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: MEDIUM - While exploitation requires authentication, internet-facing LXD instances could be targeted if credentials are compromised or weak authentication is in place.
🏢 Internal Only: HIGH - Internal attackers or compromised accounts with instance configuration permissions can exploit this to read sensitive host files.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

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

linux

Limit 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

linux

Disable 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="*{{*"

🔗 References

📤 Share & Export