{"id":"XE-10033","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"CLI Self-Fork Race Condition: cmdReceive loops multiple pending blocks without frontier propagation creating intra-account conflicts","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"invalid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"invalid","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T09:26:58.269987+00:00","updated_at":"2026-11-20T00:48:52.669827+00:00","source_created_at":null,"told_at":"2026-11-20T00:48:52.672611+00:00","status_changed_at":"2026-11-20T00:33:26.028385+00:00","url":"https://bounty.xe.network/XE-10033","body":"## Vulnerability Summary\n\nIn `cmd/xe/main.go:747-781`, `cmdReceive()` loops over unreceived pending transfers to construct and submit `BlockReceive` transactions:\n\n```go\n\tfmt.Printf(\"Receiving %d pending send(s)...\n\", len(pending))\n\tfor _, p := range pending {\n\t\tchain, _ := c.GetChain(addr)\n\t\tbals, _ := c.GetBalances(addr)\n\n\t\tprev := \"0\"\n\t\tif len(chain) > 0 {\n\t\t\tprev = chain[len(chain)-1].Hash\n\t\t}\n\n\t\tb := &core.Block{\n\t\t\tType:      core.BlockReceive,\n\t\t\tAccount:   addr,\n\t\t\tPrevious:  prev,\n\t\t\tBalance:   bals[p.Asset] + p.Amount,\n\t\t\tTimestamp: time.Now().UnixNano(),\n\t\t\tAsset:     p.Asset,\n\t\t\tSource:    p.SendHash,\n\t\t}\n...\n\t\tif err := c.SubmitBlock(b, \"receive\"); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"  skip %s: %v\n\", shortHash(p.SendHash), err)\n\t\t\tcontinue\n\t\t}\n```\n\nWhen an account has multiple pending transfers (`len(pending) > 1`), `cmdReceive()` processes them in rapid succession. On iteration 0, block $B_0$ is submitted to the node. \n\nBecause `c.SubmitBlock` returns before the network or local store propagates the new frontier block, iteration 1 immediately queries `c.GetChain(addr)` and `c.GetBalances(addr)`. The node's store has not yet committed $B_0$ or updated `chain[len(chain)-1]`.\n\nAs a result:\n1. Iteration 1 receives the exact same frontier `prev` and the exact same stale `bals[p.Asset]`.\n2. Iteration 1 generates block $B_1$ pointing to the same `Previous: prev` as $B_0$.\n3. Two blocks with identical `Previous` hashes are broadcast to the network for the same account.\n\n## Impact & Severity\n\n1. Account Deadlock: Emitting two blocks with the same `Previous` pointer triggers an immediate fork conflict (`core.ErrForkDetected`) on the user's own lattice account.\n2. Quorum Lockout: The account's chain is frozen into conflict arbitration in `core.QuorumManager`, blocking subsequent receives and sends until external representatives cast votes.\n3. Balance Corruption: Stale balance computation in subsequent iterations leads to consensus rejection with `balance mismatch`.\n\n## Proposed Remediation\n\nIn `cmdReceive()`, track local frontier state and balance offsets in-memory across loop iterations:\n```go\n\tcurrentPrev := prev\n\tcurrentBalances := bals\n\tfor _, p := range pending {\n\t\tb := &core.Block{\n\t\t\tType:      core.BlockReceive,\n\t\t\tAccount:   addr,\n\t\t\tPrevious:  currentPrev,\n\t\t\tBalance:   currentBalances[p.Asset] + p.Amount,\n...\n\t\t}\n...\n\t\tcurrentPrev = b.Hash\n\t\tcurrentBalances[p.Asset] += p.Amount\n\t}\n```","patch_refs":[],"thread":[{"id":13370,"source":"desk","source_ref":"reply:11392","author":"XE desk","team":true,"body":"Thanks for the report. We read it against the code and could not confirm a bug in what it describes.\n\nThis report is closed as invalid. If we have missed something, file a new report that links\nhttps://bounty.xe.network/XE-10033 and says what; it is read like any other.","created_at":"2026-11-20T00:48:52.669827+00:00"}]}