{"id":"CVE-2024-6219","aliases":["CVE-2024-6219","GHSA-jpmc-7p9c-4rxf","GO-2024-3313"],"related":[],"kind":"vulnerability","state":"published","title":"lxd has a restricted TLS certificate privilege escalation when in PKI mode","summary":"Mark Laing discovered in LXD's PKI mode, until version 5.21.1, that a restricted certificate could be added to the trust store with its restrictions not honoured.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mark Laing discovered in LXD's PKI mode, until version 5.21.1, that a restricted certificate could be added to the trust store with its restrictions not honoured.","source":"cvelist"},{"lang":"en","text":"### Summary\nIf a `server.ca` file is present in `LXD_DIR` at LXD start up, LXD is in \"PKI mode\". In this mode, all clients must have certificates that have been signed by the CA. \n\nThe LXD configuration option `core.trust_ca_certificates` defaults to `false`. This means that although the client certificate has been signed by the CA, LXD will additionally add the certificate to the trust store and verify it via mTLS.\n\nWhen a restricted certificate is added to the trust store in this mode, it's restrictions are not honoured, and the client has full access to LXD.\n\n### Details\nWhen authorization was refactored to allow for generalisation (at the time for TLS, RBAC, and OpenFGA, see https://github.com/canonical/lxd/pull/12313), PKI mode did not account for the `core.trust_ca_certificates` configuration option. When this option is enabled, all CA-signed client certificates are given full access to LXD. [This cherry-pick from Incus](https://github.com/canonical/lxd/pull/12513/commits/5cdc9a35b9c51e981b1e70330bde0413ccacc7fd) was added to LXD to fix the issue. \n\nThe cherry-pick fixed the immediate issue and allowed full access to LXD for CA-signed client certificates when `core.trust_ca_certificates` is enabled, but did not consider the behaviour of LXD when `core.trust_ca_certificates` is disabled. \n\nWhen `core.trust_ca_certificates` is false, restrictions that are applied to a certificate should be honoured. Instead, they are being ignored due to the presence of a `server.ca` file in `LXD_DIR`.\n\n### PoC\n```\n# Install/initialize LXD\n$ snap install lxd --channel 5.21/stable\n$ lxd init --auto\n$ lxc config set core.https_address=127.0.0.1:8443\n\n# Use easyrsa for configuring CA: https://github.com/OpenVPN/easy-rsa\n$ cp -R /usr/share/easy-rsa \"/tmp/pki\"\n$ export EASYRSA_KEY_SIZE=4096\n$ cd /tmp/pki\n$ ./easyrsa init-pki\n$ echo \"lxd\" | ./easyrsa build-ca nopass\n$ ./easyrsa build-client-full lxd-client nopass\n$ cp pki/ca.crt /var/snap/lxd/common/lxd/server.ca\n$ cp pki/issued/lxd-client.crt ~/snap/lxd/common/config/client.crt\n$ cp pki/private/lxd-client.key ~/snap/lxd/common/config/client.key\n\n# Restart daemon.\n$ systemctl reload snap.lxd.daemon\n\n# Add a restricted certificate to the trust store.\n$ token=\"$(lxc config trust add --name ca-test --quiet --restricted)\"\n$ lxc remote add tls \"${token}\"\n\n# Our client has a CA-signed certificate, but it is restricted, so the client should not be able to view server config.\n$ lxc config get tls: core.https_address\n127.0.0.1:8443\n```\n\n### Impact\nI believe this vulnerability is low impact because PKI mode is:\n1. Not the standard or recommended mode of operation for LXD.\n2. While `core.trust_ca_certificates` defaults to false, we believe that users who enable PKI mode will generally have `core.trust_ca_certificates` enabled to allow for passwordless PKI with CRL revocation (see https://github.com/canonical/lxd/issues/3832). When this mode is enabled, all clients with CA-signed certificates have root access* anyway.\n\n*Note: If a restricted certificate is added before `core.trust_ca_certificates` is enabled, the certificate becomes unrestricted. We believe this was the original intention of the PR, but this should be changed to disallow any unintended permission change.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Restricted TLS certificate privilege escalation when in PKI mode in github.com/canonical/lxd","format":"markdown","source":"go"},{"lang":"es","text":"Mark Laing descubrió en el modo PKI de LXD, hasta la versión 5.21.1, que se podía agregar un certificado restringido al almacén de confianza sin respetar sus restricciones.","source":"nvd"}],"published":"2024-12-05T23:13:19.635Z","modified":"2026-06-26T19:45:10.889Z","severity":{"scorer":"canonical","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N","score":3.8,"rating":"LOW"},"severities":[{"scorer":"canonical","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N","score":3.8,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N","score":3.8,"rating":"LOW"}],"cwes":["CWE-287","CWE-295"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"5.21.1","status":"affected"}],"vendor":"Canonical Ltd.","product":"LXD","package":"lxd","repo":"https://github.com/canonical/lxd","platforms":["Linux"],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20240403103450-0e7f2b5bf4d2"}],"ecosystem":"Go","package":"github.com/canonical/lxd","purl":"pkg:golang/github.com/canonical/lxd","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20240403103450-0e7f2b5bf4d2"}],"ecosystem":"Go","package":"github.com/canonical/lxd","purl":"pkg:golang/github.com/canonical/lxd","source":"go"},{"ranges":[{"status":"affected","fixed":"5.21.1"}],"vendor":"canonical","product":"lxd","cpe":"cpe:2.3:a:canonical:lxd:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/canonical/lxd/security/advisories/GHSA-jpmc-7p9c-4rxf","tags":["advisory","exploit","issue-tracking","vendor-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2024-6219","tags":["issue-tracking","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-6219","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/canonical/lxd/pull/12313","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/canonical/lxd/commit/5cdc9a35b9c51e981b1e70330bde0413ccacc7fd","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/canonical/lxd","tags":["package"],"sources":["ghsa"]},{"url":"https://pkg.go.dev/vuln/GO-2024-3313","tags":["web"],"sources":["ghsa"]}],"credits":["@markylaing"],"assigner":"canonical","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-12-06T16:39:00.858Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-6219","url":"https://www.cve.org/CVERecord?id=CVE-2024-6219","licence":"CVE Terms of Use","modified":"2025-08-28T13:29:18.834Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jpmc-7p9c-4rxf","url":"https://github.com/advisories/GHSA-jpmc-7p9c-4rxf","licence":"CC-BY-4.0","modified":"2026-06-26T19:45:10.889Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2024-3313","url":"https://pkg.go.dev/vuln/GO-2024-3313","licence":"CC-BY-4.0","modified":"2024-12-11T17:13:38.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-6219","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-6219","licence":"Public domain","modified":"2026-06-17T08:17:32.460Z"}],"updatedAt":"2026-11-25T22:58:49.757Z","epss":{"score":0.00157,"percentile":0.05128,"date":"2026-12-01T12:00:22.000Z"}}