# csi-snapshot-controller crashes when processing VolumeSnapshot with non-existing PVC

A VolumeSnapshot referencing a non-existent PVC causes a nil pointer dereference in csi-snapshot-controller, crashing it in a restart loop and blocking snapshot operations.

- Payout: $500
- Severity: medium
- Program: Kubernetes
- Found by (vendor credit): Qin Ping
- Found by: piqin
- Disclosed: 2020-12-03
- CVE: CVE-2020-8569
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1032086
- Library page: https://bugbountylibrary.com/r/h1%3A1032086
- Tags: area:cloud domain:cloud impact:dos kind:bounty platform:hackerone sev:medium tech:kubernetes technique:source-review vuln:dos

**Target:** csi-snapshot-controller (external-snapshotter v3.0.0) VolumeSnapshot processing
**Root cause:** syncSnapshotByKey dereferences a nil snapshot source/class pointer when the referenced PVC does not exist and spec.volumeSnapshotClass is empty, after setDefaultClass fails to resolve the source PVC name.
**Steps:**
1. Install Kubernetes 1.19 with snapshot-controller v3.0.0
2. Create a VolumeSnapshot with empty spec.volumeSnapshotClass and spec.source.persistentVolumeClaimName set to a non-existent PVC name (`blabla`)
3. Observe snapshot-controller panic with `invalid memory address or nil pointer dereference` at snapshot_controller_base.go:215
4. Controller restarts and crashes again on the same object, looping
**How found:** Likely observed controller crash logs while testing VolumeSnapshot creation with a missing PVC reference; the panic trace pointed to syncSnapshotByKey dereferencing a nil pointer after setDefaultClass failed.
**Exploitation:** Any user able to create a VolumeSnapshot object submits one referencing a non-existent PVC; the controller panics on processing, is restarted by Kubernetes, and re-crashes on the same object indefinitely, causing persistent DoS of snapshot functionality.
**Insight:** Controllers that resolve referenced objects (PVCs) should treat lookup failure as a terminal error path, not proceed to dereference; test snapshot/backup controllers with dangling references to non-existent source objects to trigger nil derefs.

## Proof of concept (copied exactly from the original report)

**VolumeSnapshot manifest with non-existing PVC name**

```
apiVersion: snapshot.storage.k8s.io/v1beta1
    kind: VolumeSnapshot
    metadata:
      name: new-snapshot
    spec:
      source:
        persistentVolumeClaimName: blabla
```

