# GHSA-3g2j-vm47-x4mj: LXD vulnerable to a local privilege escalation through custom storage volumes

> An unprivileged user with container access can escalate to root on the host by exploiting custom storage volume permissions.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Nov 2025
- **Also known as:** GO-2025-4121

## What is GHSA-3g2j-vm47-x4mj?

GHSA-3g2j-vm47-x4mj is a vulnerability in github.com/canonical/lxd, published on 13 Nov 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

**Impact**

This affects any LXD user in an environment where an unprivileged user may have root access to a container with an attached custom storage volume that has the `security.shifted` property set to `true` as well as access to the host as an unprivileged user.

The most common case for this would be systems using `lxd-user` with the less privileged lxd group to provide unprivileged users with an isolated restricted access to LXD. Such users may be able to create a custom storage volume with the necessary property (depending on kernel and filesystem support) and can then write a setuid binary from within the container which can be executed as an unprivileged user on the host to gain root privileges.

**Patches**

Patches for this issue are available: 

- LXD 6 series: https://github.com/canonical/lxd/pull/16904
- LXD 5.21 LTS series: https://github.com/canonical/lxd/pull/16922
- LXD 5.0 LTS series: https://github.com/canonical/lxd/pull/16923
- LXD 4.0 LTS series: https://github.com/canonical/lxd/pull/16924 

The first commit changes the permissions for any new storage pool, the later commit adds a patch that applies it on startup to all existing storage pools.

These fixes are also available in the associated candidate snap channels for each LTS series:

- 5.21/candidate (5.21.4-8a3cf61)
- 5.0/candidate (5.0.5-5c60378)
- 4.0/candidate (4.0.10-35a8127)

We will be preparing intermediate releases to the associated stable snap channels shortly.

**Workarounds**

Permissions can be manually restricted until a patched version of LXD is deployed.

This is done with:

```
sudo nsenter --mount=/run/snapd/ns/lxd.mnt -- chmod 0700 /var/snap/lxd/common/lxd/storage-pools/*/{custom*,virtual-machines*,images}
sudo nsenter --mount=/run/snapd/ns/lxd.mnt -- chmod 0711 /var/snap/lxd/common/lxd/storage-pools/*/{containers*,buckets*}
```

Those are the same permissions which will be applied by the patched LXD for both new and existing storage pools.

**References**

This was reported to Incus publicly on Github here: 

- https://github.com/lxc/incus/security/advisories/GHSA-56mx-8g9f-5crf
- https://github.com/lxc/incus/issues/2641

## Which versions are affected by GHSA-3g2j-vm47-x4mj?

3 open source packages ship an affected version, including github.com/canonical/lxd.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/canonical/lxd` | Go | All versions | None |
| `github.com/canonical/lxd` | Go | All versions | 0.0.0-20251110144034-698854d0164f |
| `github.com/canonical/lxd` | Go | All versions | 0.0.0-20251110144034-698854d0164f |

## How do I fix GHSA-3g2j-vm47-x4mj?

Upgrade github.com/canonical/lxd to 0.0.0-20251110144034-698854d0164f or later.

## Is GHSA-3g2j-vm47-x4mj being exploited?

There is no known exploitation of GHSA-3g2j-vm47-x4mj in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-3g2j-vm47-x4mj and fix it if it is affected.

What it is: GHSA-3g2j-vm47-x4mj is a vulnerability in github.com/canonical/lxd, published on 13 Nov 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-3g2j-vm47-x4mj in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/canonical/lxd (Go): affected all versions; no fix listed
- github.com/canonical/lxd (Go): affected all versions; fixed in 0.0.0-20251110144034-698854d0164f
- github.com/canonical/lxd (Go): affected all versions; fixed in 0.0.0-20251110144034-698854d0164f

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-3g2j-vm47-x4mj/ (Markdown: https://insights.sbomify.com/GHSA-3g2j-vm47-x4mj/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-3g2j-vm47-x4mj

---
From sbomify Insights: https://insights.sbomify.com/GHSA-3g2j-vm47-x4mj/
Summaries are generated and may contain mistakes; the official description above is the record.
