{"id":"XE-10006","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Provider VM State Deletion on Restart: cleanOrphans forcibly terminates and deletes all active consumer VMs on daemon startup","area":"node-api","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0114","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T09:05:29.815003+00:00","updated_at":"2026-11-20T00:33:20.208339+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:20.229807+00:00","status_changed_at":"2026-11-20T00:33:20.212067+00:00","url":"https://bounty.xe.network/XE-10006","body":"## Vulnerability Summary\n\nIn `vm/lima_manager.go:325-347` (and similarly `vm/qemu_manager.go:361-373`), `cleanOrphans()` is invoked unconditionally during manager initialization (`NewLimaManager`, line 85):\n\n```go\nfunc (m *LimaManager) cleanOrphans() {\n\tout, err := m.runLimactl(\"list\", \"--json\")\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, line := range strings.Split(strings.TrimSpace(out), \"\n\") {\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar entry struct {\n\t\t\tName   string `json:\"name\"`\n\t\t\tStatus string `json:\"status\"`\n\t\t}\n\t\tif err := json.Unmarshal([]byte(line), &entry); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(entry.Name, \"xe-\") {\n\t\t\tlog.Printf(\"Cleaning orphaned Lima VM: %s (status: %s)\", entry.Name, entry.Status)\n\t\t\t_, _ = m.runLimactl(\"stop\", entry.Name)\n\t\t\t_, _ = m.runLimactl(\"delete\", \"--force\", entry.Name)\n\t\t}\n\t}\n}\n```\n\nWhen a provider node restarts (due to routine maintenance, OS update, or daemon reload), `m.vms` is initialized as an empty in-memory map. `cleanOrphans()` executes before any leases are reconciled or reloaded.\n\nBecause the manager does not maintain persistent on-disk state or cross-reference active on-chain leases (`LeaseAccepted`) from the ledger, it assumes that *all* existing VMs matching the `xe-` naming convention are orphans.\n\nThe daemon immediately issues `limactl stop <name>` and `limactl delete --force <name>`, forcibly terminating and permanently purging the virtual disks and environments of all active, paid consumer workloads.\n\n## Impact & Severity\n\n1. Total Workload Destruction: Every daemon restart or crash recovery completely deletes all running consumer virtual machines, destroying uncommitted customer data and in-flight computing jobs.\n2. Provider Slashing & Invalidation: On-chain leases remain active in `LeaseAccepted` status until settlement or expiration. Because the VM is destroyed, the provider can no longer pass attestation or performance proofs, resulting in consumer force-settlement and loss of provider stake.\n\n## Proposed Remediation\n\n1. Implement state persistence: Save active VM metadata (lease hash, ssh port, instance name) to a persistent manifest in `dataDir`.\n2. Reconcile on startup: During startup, cross-check existing instances against the ledger's active leases. Re-attach to healthy instances and populate `m.vms` instead of deleting them.\n3. Only purge VMs whose corresponding on-chain leases are confirmed terminated (`LeaseSettled`, `LeaseCancelled`, or `LeaseExpired`).","patch_refs":[],"thread":[{"id":13246,"source":"desk","source_ref":"reply:11268","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0114, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-10006 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:20.208339+00:00"}]}