# GHSA-9P5F-CJ8J-2GVW: Path traversal in proxy and GPU device names leads to arbitrary file write, deletion and process termination on the host

- Database: GitHub
- Severity: CVSS 8.2 (High)
- Published: 2026-11-26
- Modified: 2026-11-26

## Tracked as

- [CVE-2026-127153](https://cve.now/CVE-2026-127153.md): Canonical LXD arbitrary host file access via proxy and GPU device names

## Affected versions

- github.com/canonical/lxd (Go): from 5.0

## Description

### Summary

LXD used the raw device name to build file paths for proxy devices and for GPU devices that use CDI. Device names may contain `/` and `.`, so a user allowed to add these devices to an instance could make LXD write, read and delete files outside the instance's own directories, as root on the host.

### Details

#### Proxy devices

When a non-NAT proxy device starts, LXD:

* creates or truncates `<logs>/<instance>/proxy.<name>.log`
* writes the forkproxy AppArmor profile to `<var>/security/apparmor/profiles/lxd_forkproxy-<name>_<instance>` and loads it with `apparmor_parser`
* writes a YAML PID file to `<devices>/<instance>/proxy.<name>`

When the device stops, LXD reads the PID file at `<devices>/<instance>/proxy.<name>`, kills the process it names and deletes the file.

With a name such as `x/../../../../../../../../tmp/pwned`, each of these paths resolves outside the intended directory. The last component of the PID file path is entirely chosen by the attacker. As a result:

* **Arbitrary file overwrite as root:** the PID file and the AppArmor profile. The profile's content is partly controlled through the `listen` and `connect` socket paths.
* **Creation or truncation of arbitrary `*.log` files.**
* **Termination of an arbitrary host process and deletion of a chosen file:** the attacker plants a crafted PID file at the target path, which can be done from inside a container's root filesystem, then stops the device.

#### GPU devices using CDI

When a container GPU device whose `id` is a CDI identifier (for example `nvidia.com/gpu=0`) starts, LXD writes two JSON files:

* `<devices>/<instance>/<name>_cdi_config_devices.json`
* `<devices>/<instance>/<name>_cdi_hooks.json`

Both are deleted when the device stops. `gputype=mig` devices use the same files on 6.x.

With a traversal name, LXD creates or overwrites, as root, files ending in `_cdi_config_devices.json` and `_cdi_hooks.json` anywhere on the host, and deletes such files when the device stops. The content is JSON generated by LXD. LXD reads these files back, but only applies their content inside the container. The files are only written once LXD has resolved the CDI identifier, so the host needs a CDI specification for the GPU, such as one generated by the NVIDIA Container Toolkit.

### Affected versions

* **Proxy devices:** the vulnerable code is present on `stable-4.0`, `stable-5.0`, `stable-5.21`, `stable-6` and `main`. The forkproxy AppArmor profile was added in 2020. Device name validation (`^[/.\-:_a-zA-Z0-9]+$`) allows these names on 5.0 and later; 4.0 won't be evaluated as all authenticated users are effectively root.
* **GPU devices using CDI:** LXD 5.21.3 and later, and 6.2 and later (`stable-5.21`, `stable-6` and `main`).

### Proof of concept

Proxy device:

```
lxc launch ubuntu-minimal-daily:24.04 c1
lxc config device add c1 'x/../../../../../../../../../tmp/pwned' proxy listen=tcp:127.0.0.1:1234 connect=tcp:127.0.0.1:80
ls -l /tmp/snap-private-tmp/snap.lxd/tmp/pwned /tmp/snap-private-tmp/snap.lxd/tmp/pwned.log /tmp/snap-private-tmp/snap.lxd/tmp/pwned_c1
lxc config device remove c1 'x/../../../../../../../../../tmp/pwned'
```

GPU device, on a host with an NVIDIA GPU and a CDI specification:

```
lxc launch ubuntu-minimal-daily:24.04 c1
lxc config device add c1 'x/../../../../../../../../../tmp/pwned' gpu id=nvidia.com/gpu=0
ls -l /tmp/snap-private-tmp/snap.lxd/tmp/pwned_cdi_config_devices.json /tmp/snap-private-tmp/snap.lxd/tmp/pwned_cdi_hooks.json
lxc config device remove c1 'x/../../../../../../../../../tmp/pwned'
```

### Impact

Restricted projects block both device types by default (`restricted.devices.proxy=block` and `restricted.devices.gpu=block`). The issue matters where an unprivileged user can add these devices: restricted projects with `restricted.devices.proxy=allow` or `restricted.devices.gpu=allow`. The GPU path also needs a CDI-capable GPU on the host. In unrestricted projects, a user who can edit instances can already gain root on the host by other means.

## References

- https://github.com/canonical/lxd/security/advisories/GHSA-9p5f-cj8j-2gvw

Page: https://cve.now/GHSA-9P5F-CJ8J-2GVW

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
