# GHSA-86FG-V73J-R37J: Instance copy refresh modifies an existing target without edit permission

- Database: GitHub
- Severity: CVSS 6.8 (Medium)
- Published: 2026-12-03
- Modified: 2026-12-03

## Tracked as

- [CVE-2026-135363](https://cve.now/CVE-2026-135363.md): lxd: Unauthorized modification of existing instances via copy refresh in instance creation requests

## Description

# Instance copy refresh modifies an existing target without edit permission

## Severity

Proposed CVSS v3.1 base score: **6.8 (Medium)**. `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H`.

A create-only caller depends on an existing compatible target being stopped, a state outside that caller's control. The score reflects replacement of the target's configuration and data and the resulting loss of access to the original workload and snapshots.

## Summary

An authenticated identity that holds the project-level `can_create_instances`
entitlement, but does **not** hold `can_edit` on an existing instance, can send
`POST /1.0/instances` with `source.type: "copy"` and `source.refresh: true`,
naming that existing instance as the target. `POST /1.0/instances` is gated only
by `can_create_instances` on the project, whereas ordinary `PUT`, `POST` and
`PATCH` on `/1.0/instances/{name}` require `can_edit` on that specific instance.
The copy-refresh path loads the existing target and calls
`inst.Update(..., UpdateActionUserRefresh)` before taking an exclusive lock, and
then refreshes its storage volume. There is no target-specific `can_edit` check
anywhere on that path. A create-only identity can therefore overwrite the
configuration and root filesystem of an instance it is not allowed to edit.

## Runtime reproduction (LXD 7.0)

Everything below was executed against one explicitly configured LXD daemon in a
disposable, rootless Podman container (`--network none`, `--rm`, no bind mounts,
its own `LXD_DIR`, `LXD_CONF` and `LXD_SOCKET`). The host LXD installation was
not contacted. All data is synthetic; there is no scanning, no persistence and
no real credential material. Single target: the container's own loopback.

Lab daemon: LXD `7.0`, Ubuntu Core 26, snap `git-81a7f39` (revision 41248),
`core.https_address = 127.0.0.1:8443`.

Setup performed over the local admin unix socket:

* storage pool `poc` (`dir` driver);
* a synthetic image (`metadata.yaml` plus one marker file) imported as `lab`;
* two **stopped**, privileged containers created from it: `src` and `target`;
* distinct markers written directly into their root volumes:
  `src/rootfs/MARKER = SOURCE-DATA`, `target/rootfs/MARKER = TARGET-ORIGINAL`;
* an embedded OpenFGA fine-grained authorization group `creators` and a TLS
  identity `creator`:

```json
POST /1.0/auth/groups
{
  "name": "creators",
  "description": "may create instances in default, may NOT edit target",
  "permissions": [
    {"entity_type":"project","url":"/1.0/projects/default","entitlement":"can_view"},
    {"entity_type":"project","url":"/1.0/projects/default","entitlement":"can_create_instances"},
    {"entity_type":"instance","url":"/1.0/instances/src?project=default","entitlement":"can_view"},
    {"entity_type":"instance","url":"/1.0/instances/target?project=default","entitlement":"can_view"}
  ]
}
```

```json
POST /1.0/auth/identities/tls
{"name":"creator","certificate":"<PEM>","groups":["creators"]}
```

The group grants **no** `can_edit` on `target` and no `can_edit_instances` on
the project. The entitlement model in this build is embedded OpenFGA; a legacy
`restricted: true` TLS certificate is *not* fine-grained and would not
demonstrate this boundary.

Controls and attack, all sent as the `creator` TLS identity over HTTPS:

| Step | Request | Observed result |
| --- | --- | --- |
| Control 1 | `PATCH /1.0/instances/target?project=default` | **403 Forbidden** — the instance-level `can_edit` gate works |
| Control 2 | `POST /1.0/instances?project=default`, copy `src` to a **new** name `creator-new` | `202`, operation `Success` — the legitimate create right works |
| Attack | `POST /1.0/instances?project=default` with `name: "target"`, `source.refresh: true` | `202`, operation `Success` (`status_code: 200`) |

Attack body (abridged; protected `volatile.*` keys are carried forward from the
target so the refresh validator accepts it):

```json
{
  "name": "target",
  "architecture": "x86_64",
  "config": {
    "user.attacker.marker": "OVERWRITTEN-BY-CREATE-ONLY-IDENTITY",
    "...": "<target volatile.* values>"
  },
  "devices": {"...": "<target devices>"},
  "profiles": ["default"],
  "description": "OVERWRITTEN-BY-CREATE-ONLY-IDENTITY",
  "ephemeral": false,
  "start": false,
  "source": {"type": "copy", "source": "src", "refresh": true, "project": "default"}
}
```

Observed state of `target` before and after (admin view):

| Field | Before | After |
| --- | --- | --- |
| `description` | `""` | `"OVERWRITTEN-BY-CREATE-ONLY-IDENTITY"` |
| `config.user.attacker.marker` | absent | `"OVERWRITTEN-BY-CREATE-ONLY-IDENTITY"` |
| `rootfs/MARKER` on disk | `TARGET-ORIGINAL` | `SOURCE-DATA` |

The storage phase completed too, so the target's root volume was replaced by the
source's contents, not merely its database record. Full transcripts are in
`evidence/01-poc-a.log`; the runnable harness is in `harness/`.

## Details (source trace)

* `lxd/instances.go:35` — `POST /1.0/instances` uses
  `allowPermission(entity.TypeProject, auth.EntitlementCanCreateInstances)`.
* `lxd/instances.go:45,47,48` — `PUT`, `POST` and `PATCH` on
  `/1.0/instances/{name}` use
  `allowPermission(entity.TypeInstance, auth.EntitlementCanEdit, "name")`.
  `instancePut` and `instancePatch` contain no in-handler permission check and
  rely entirely on that access handler.
* `lxd/instances_post.go:1629` — the only `CheckPermission` call in
  `instancesPost`; it checks `can_view` on the **source**, not the target.
* `lxd/instances_post.go:1950-1958` — the "name already in use" conflict check
  is skipped when `source.refresh` is set.
* `lxd/instances_post.go:914-926,982-991` — `createFromCopy` builds
  `db.InstanceArgs` from the client body and calls `instanceCreateAsCopy` with
  `refresh: req.Source.Refresh`.
* `lxd/instance.go:330-345` — when the target exists, the handler loads it and
  calls `inst.Update(ctx, opts.targetInstance, instance.UpdateActionUserRefresh)`
  at `:341`. No `can_edit` check. This runs **before** `LockExclusive()` at
  `:360`, and the local-copy path installs no revert hook for the configuration,
  so the database mutation is already committed even if the storage phase later
  fails.
* `lxd/instance.go:488-492` → `lxd/storage/backend_lxd.go:1882-2144` —
  `pool.RefreshInstance` deletes/recreates target snapshots and overwrites the
  root volume from the source.
* `lxd/instance/drivers/driver_lxc.go:3858-3865,4336-4382` — `Update` persists
  `Description`, `Architecture`, `Ephemeral`, the full `localConfig`, the full
  `localDevices` and `Profiles` to the database.
* `lxd/instance/drivers/driver_common.go:2567-2588` — the refresh validator
  refuses deletion of protected `volatile.*` keys; a client must carry them
  forward (the reproducer does).
* `lxd/instances_post.go:2306-2330` — `start: true` in the same request would
  additionally boot the target with the attacker-supplied configuration. This
  was **not** exercised in the lab and is noted only as a code observation.

## Impact

Within a project where the identity holds `can_create_instances`, that identity
can modify an existing instance it is forbidden to edit: overwrite its
configuration, devices, profiles and description; delete and replace its
snapshots; and replace its root filesystem with data from any source it may
view. This is an authorization boundary violation affecting integrity and
availability (data loss). It does not, by itself, grant cross-project access,
host compromise, or privilege escalation on the host.

Preconditions: a fine-grained (OpenFGA) identity with project visibility and
`can_create_instances`; a source instance it may view; an existing, stopped
target of a compatible type; and normal project restrictions. These are
prerequisites, not claims about default permissions or deployment prevalence.

## Affected versions

Reproduced end-to-end on LXD **7.0** (snap `git-81a7f39`, revision 41248,
Ubuntu Core 26). The source trace above is pinned to development revision
`c4a87bc5626cec1a9ee5770f51005b1615db39bb`
(`lxd-6.10.0-367-gc4a87bc562`). The two revisions were **not** diffed: the
local source checkout is shallow (single commit) and the snap reports an
earlier build, so exact commit equivalence is not claimed — only that the
observed runtime behaviour matches the traced code path. The earliest affected
release, the full affected range and the fixed release remain unestablished.

Canonical identified the `5.21`, `6.0` and `main` branches as affected. The first affected and first fixed releases remain unknown.

## Suggested fix

Before any copy-refresh mutation, resolve the existing target and require
`can_edit` on that specific instance. Apply the same target authorization to
every refresh entry path, including migration and internal cluster forwarding,
while retaining the existing source and project checks. A regression test should
confirm that a create-only identity is denied a refresh of an existing target,
that an authorized identity can still refresh it, and that creating a new target
remains allowed.

## References

- https://github.com/canonical/lxd/security/advisories/GHSA-86fg-v73j-r37j

Page: https://cve.now/GHSA-86FG-V73J-R37J

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