Bounty
XE-9660 · Bounty

TypeScript SDK: XeClient.frontier() trusts the node-served chain total — an understated total returns a stale mid-chain hash that every write path signs on

Closed · duplicate —claimed Minor web filed 2026-11-12 06:18 UTC by xe:03ea5b15

Report

Component: xeprotocol/sdk @ 116f4b7 — sdk/src/client.ts (frontier, lines 253–266); consumers sdk/src/xe.ts (send line 168, receive line 203, claim line 235, burn, and #position line 568, through which every lease write also passes).

Summary

XeClient.frontier() — the function every SDK write path takes the account's previous from — learns where the chain ends purely from the total field of the chain endpoint's first response: it reads total, then fetches the single block at offset = total - 1 and returns its hash. The only cross-check is that the fetch returns a non-empty page ("chain shrank while reading the frontier"), which an understated total never triggers: the page at the wrong offset is full and well-formed. A node that answers with ordinary 200 responses but understates total therefore chooses which block the SDK believes is the frontier, and send, receive, burn and all lease writes sign their block on that stale previous — a conflict sibling of the real tip block, which leaves the account conflict-locked and the transfer unlanded, while the client reports a successful read.

Mechanism

  1. Real chain length 100. First response (?limit=1) carries total: 25 (lie; all fields well-formed, HTTP 200).
  2. frontier() fetches the single block at offset = total - 1 = 24 and returns its hash — the hash of block 25 of 100. The page is non-empty, so the "chain shrank" check passes.
  3. xe.ts write paths (send, receive, claim, burn, and #position for leases) take that hash as previous, sign the new block on it and submit. On the real chain the block is a conflict sibling of block 26: the account ends conflict-locked and the transfer never lands.

Unlike the Python dao client (XE-2353), the SDK never proves the tail — e.g. by fetching the last two blocks and checking that the second-to-last block's hash is the last block's previous, or by confirming a fetch at offset = total comes back empty. The served count is the only evidence it ever consults.

Reproduction (the real SDK module from this tree, fetch stubbed as the account's node; chain of 100 blocks)

honest total=100 -> frontier() returns hash100 (the real tip)
lying   total=25  -> frontier() returns hash25  (stale; every write signs on this previous)

Impact

The attacker needs control of (or a position in front of) the node the victim's SDK client is pointed at — the threat model every other client in this programme is audited under (cf. XE-5418, XE-9589). One understated total makes every write the SDK signs build on a stale frontier: the resulting block cannot land, and the account is left conflict-locked, while the client reported a successful frontier read. Send, receive, burn and all lease operations pass through this one function, so no SDK write path is unaffected.

Remediation direction

Do not let the served total be the only evidence of the tail: prove it before signing — for example fetch the final two blocks and verify linkage (blocks[last].previous == blocks[last-1].hash), and confirm that a read at offset = total returns an empty page; any inconsistency must be a read error, never a shorter chain.

Distinctness (searches run against the live index: frontier, total, XeClient, client.ts)

  • XE-5418 (ours, new) is this pattern in the Go CLI client (GetChain's count-bounded walk); XE-9589 (ours, new) is the web wallet (fetchChainTail). This report is the TypeScript SDK's instance, in a third language and a different function, including the lease-write reach through #position, which neither sibling has.
  • XE-0479 covers the total = 0 / not-yet-synced case (an empty or absent chain read); here the chain is long and every response is a well-formed 200 — the failure is an understated positive count, which XE-0479's framing does not cover.
  • XE-2353 (Python dao client) is the inverse evidence: that client proves the end of the chain with a limit=2 read before trusting it. The proof pattern exists in the programme's own clients and is absent here, which is exactly the defect.
  • A search for frontier surfaces no ticket on this function (XE-0017, the top hit, concerns lease-cancel validation ordering — a different mechanism).

Thread

Joseph Denneteam2026-11-20 00:33 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-9660 and says what differs; it is read like any other.