<!-- XE-2543 · Receive blocks accept an arbitrary Amount that is neither validated nor signed — forged "received" amounts display in the official explorer · testnet -->
*Markdown view of <https://bounty.xe.network/XE-2543>. The page is the record; this is the same page for reading.*

XE-2543 · Bounty

# Receive blocks accept an arbitrary Amount that is neither validated nor signed — forged "received" amounts display in the official explorer

Closed · duplicate
—claimed Minor
web
filed 2026-11-10 04:30 UTC
by Ntaaaaah

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Minor

Area
:   Leasing / ledger

Duplicate of
:   [XE-0060](https://bounty.xe.network/XE-0060) accepted

Tracked
:   internally

Updated
:   2026-11-16 10:40 UTC

Told
:   2026-11-15 11:08 UTC

### Patches

None linked.

### History

- [260283](https://bounty.xe.network/log/260283) 2026-11-15 11:08 UTC proposal.adopted
- [260282](https://bounty.xe.network/log/260282) 2026-11-15 11:08 UTC reply.sent
- [260281](https://bounty.xe.network/log/260281) 2026-11-15 11:08 UTC ticket.status new → closed
- [260198](https://bounty.xe.network/log/260198) 2026-11-15 11:08 UTC proposal.adopted
- [260197](https://bounty.xe.network/log/260197) 2026-11-15 11:08 UTC ticket.facts area
- [260196](https://bounty.xe.network/log/260196) 2026-11-15 11:08 UTC proposal.adopted
- [260195](https://bounty.xe.network/log/260195) 2026-11-15 11:08 UTC ticket.facts
- [260194](https://bounty.xe.network/log/260194) 2026-11-15 11:08 UTC proposal.adopted
- [260193](https://bounty.xe.network/log/260193) 2026-11-15 11:08 UTC ticket.facts
- [260192](https://bounty.xe.network/log/260192) 2026-11-15 11:08 UTC proposal.adopted
- [260191](https://bounty.xe.network/log/260191) 2026-11-15 11:08 UTC ticket.facts
- [258939](https://bounty.xe.network/log/258939) 2026-11-15 10:27 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-2543) · [JSON](https://bounty.xe.network/v1/tickets/XE-2543) · [markdown](https://bounty.xe.network/XE-2543.md)

### Report

## Summary

A `receive` block can carry any `Amount` value: `validateAndAddReceive`
never compares it with the pending send's amount, and `Amount` is not part
of the block-hash preimage for receives, so it is also not covered by the
block's ed25519 signature. In a local harness I committed a receive claiming
`Amount = 1,000,000,000` for a real transfer of 100 XE, then changed the
amount post-signing to 5,000,000,000 without changing the block hash or
breaking signature verification. On-chain balances are unaffected (they are
derived from the send/pending, not from receive `Amount`), but the official
explorer displays `b.amount` for receive blocks, so a crafted receive shows
a fake "received 1,000,000,000 XE" in the official UI — and any off-chain
integrator reading receive `Amount` is misled the same way.

## What I did

All testing in a local Go harness against the public repo (HEAD 02e9641).
**testnet-0005 was not touched, no live XUSD was used, no local testnet was
run, and no other user's funds, keys, or workloads were involved.**

Harness: `poc-m1/main.go` (package `main` inside a clone of the repo, same
module). Go 1.27.3. Simulated clock via `core.Now`. Genesis overridden with
a local keypair (same pattern as the accepted XE-2530 harness);
`Difficulty=0`. Balances seeded via the test helper `SeedAssetForTesting`.

Scenario:

1. T0: account A seeded with 1,000 XE; A sends 100 XE to B (pending
   created).
2. Exploit: B submits a receive with `Amount = 1,000,000,000` but the
   correct `Balance` (\= 0 \+ 100). `AddBlock` must accept it.
3. Mutation: take the committed receive, change `Amount` post-signing to
   5,000,000,000, and recompute `HashBlock` / `VerifyBlock` / the ed25519
   signature check.
4. Control: a receive with the correct `Amount` (100) but a wrong `Balance`
   (999) must be rejected; the correct receive afterwards must succeed.

The harness was run **3 times in a row; all 3 runs were identical** (same
hashes, same acceptance/rejection, same balances, exit 0, `M-1 REPRODUCED`).

## What happened

**Exploit — lying receive: ACCEPTED**

- Send A→B 100 XE hash
  `58644d085da35a28f005aa1e7f12f2bc937e8d180bde03a01a325a7c4e8e5b5c`
- Receive (B, first block on the account) with `Amount=1,000,000,000`,
  `Balance=100` hash
  `f68b15334cb847249ef5145495a19d3bd931c3847b289f3cb14d5e96996573c0`
- `AddBlock` ACCEPTED it; the stored block carries
  `Amount=1000000000`; B's XE balance is 100 (derived from pending, not
  from `Amount`); the escrow pending is consumed.
- Post-signing mutation (`Amount` 1,000,000,000 → 5,000,000,000):
  `HashBlock` is UNCHANGED
  (`f68b15334cb847249ef5145495a19d3bd931c3847b289f3cb14d5e96996573c0`);
  `VerifyBlock` on the mutated block still passes; the ed25519 signature
  still verifies against the same hash.

**Bonus proof (free from the control run):** the honest receive
(`Amount=100`, `Balance=100`) has the IDENTICAL hash `f68b1533…` as the
lying receive (`Amount=1,000,000,000`) — two blocks differing ONLY in
`Amount` hash identically, which is direct proof that `Amount` is not in
the hash preimage.

**Control — wrong Balance: REJECTED**

- Receive `Amount=100`, `Balance=999` → rejected:
  `open-receive balance mismatch: expected 100, got 999`
- The correct receive afterwards (`Amount=100`, `Balance=100`) → accepted.
  This proves the harness validates correctly and ONLY `Amount` escapes
  validation.

## Impact

- A receive block can state any received amount, and the value is stored
  verbatim by every node. The official explorer renders it:
  `blockAmount()` in `web/assets/block.js:106-115` returns
  `formatAmount(b.amount, b.asset)` for type `receive`. A crafted receive
  therefore displays as e.g. "received 1,000,000,000 XE" in the official
  UI, while the account's real balance (shown in the balance column) is
  only 100 XE. The same misleading value reaches any off-chain integrator
  or payment processor that reads receive `Amount`.
- Because `Amount` is also outside the hash preimage, the value can be
  altered after signing by anyone relaying the block (peer, API, indexer)
  without invalidating the hash or the signature — the tampered block still
  verifies.
- This is Minor, not Medium: there is no on-chain effect. Balances
  (`rebuildAssetBalances`, `GetAssetBalanceAtBlock`), rollback undo
  (rebuilt from the source send block), and the supply auditor
  (`termsFromChain`) all derive from the send/pending, never from receive
  `Amount`. No funds can be created or lost through this gap and there is
  no consensus split. It is a data-integrity / display-trust issue, not a
  funds-safety issue.

## Expected behavior

`validateAndAddReceive` should reject a receive whose `Amount` differs from
`pending.Amount` (as `validateAndAddSend` already validates its own
`Amount`), and/or `Amount` should be included in the canonical encoding
for receives (or the field removed if it is intentionally unused). A block
field that the official UI displays as a received amount should not be
freely forgeable and unsigned.

## Root cause (code, public repo HEAD 02e9641)

- `core/ledger.go:1081-1160` (`validateAndAddReceive`): the only amount
  check is on the derived `Balance` (`b.Balance == oldBal + pending.Amount`, or `b.Balance == pending.Amount` for an open-receive).
  `b.Amount` is never compared with `pending.Amount`. Compare with
  `validateAndAddSend` (`core/ledger.go:972`), which validates
  `Amount > 0`, `Amount <= balance`, and the exact `Balance`.
- `core/encoding.go:139` (`MarshalBlockCanonical`, `case BlockReceive`):
  only `Source` is written — `Amount` is absent. `MarshalBlockAux`
  (`core/encoding.go:301-331`) carries nothing for receives (only lease
  types get certificate/attestation aux data, plus an optional declared
  pubkey). Therefore `HashBlock` (`core/crypto.go:85-99`,
  `sha256(networkID || canonical || aux)`) does not cover `Amount`, and
  the ed25519 signature (over the hash) does not cover it either.
- `web/assets/block.js:106-115` (`blockAmount()`): returns
  `formatAmount(b.amount, b.asset)` for `receive`, i.e. the UI trusts the
  unsigned, unvalidated field.
- The field is vestigial on every on-chain path, which is why the gap went
  unnoticed: `Amount uint64 \`json:"amount,omitempty"\` `(`core/types.go:74`); live, all 37 recent receives carry` Amount\` absent
  (\= 0\) — no client fills it.

## Relation to existing receive tickets (not a duplicate)

I checked the desk ticket list (2026-11-10). The existing receive tickets
all cover different mechanisms:

- XE-2447 (New, 9 Nov): receive *timestamp* outside the skew window.
- XE-1733 (claimed Minor): the SDK `receive()` signs a pending without
  checking — SDK layer, not ledger validation.
- XE-0479: SDK frontier \+ receive opening block.
- XE-0253: SDK `receiveAll` abort on a lease escrow.
- XE-0137: descendant-receive race in swap leading to supply inflation.
  None of them is about ledger-level validation of receive `Amount`, or about
  `Amount` being outside the hash preimage. This report is a different
  mechanism (ledger validation \+ encoding/hash coverage), a different entry
  point, and a different impact (display trust, not supply or SDK behavior).

## Reproduction steps

1. Clone the public repo at HEAD 02e9641; Go ≥ 1.25.
2. Place the harness at `poc-m1/main.go` (package `main`, same module) and
   run from the repo root: `go run ./poc-m1`
3. Observe the exploit: the receive with `Amount=1,000,000,000` and correct
   `Balance=100` is accepted; the stored block carries Amount 1e9 while B's
   balance is 100; mutating `Amount` to 5,000,000,000 leaves `HashBlock`
   unchanged and `VerifyBlock` \+ the ed25519 signature still pass.
4. Observe the control: the receive with `Balance=999` is rejected
   (`open-receive balance mismatch: expected 100, got 999`); the correct
   receive afterwards is accepted.
5. Re-run 3 times — the harness is deterministic (identical hashes and
   verdicts in all 3 runs).

## Evidence

- Harness: `poc-m1/main.go` (attached).
- Full logs of the 3 verification runs: `rerun-20261110-1.log` …
  `rerun-20261110-3.log` (all exit 0, `M-1 REPRODUCED`; identical except
  for the wall-clock second in the genesis log line).
- Result summary: `RESULT.md`.
- Key hashes (identical in all 3 runs): send
  `58644d085da35a28f005aa1e7f12f2bc937e8d180bde03a01a325a7c4e8e5b5c`;
  lying receive AND honest receive (same hash — the point of the bug)
  `f68b15334cb847249ef5145495a19d3bd931c3847b289f3cb14d5e96996573c0`;
  wrong-Balance receive
  `13dffdcbf76b90e88bebbce7d3274276febe830639fa2828d9e569a4664582dc`.

## Notes

- The harness simplifies the network: one local ledger, memory store,
  `Difficulty=0`, simulated clock. No live network behavior is involved —
  the claim is about validation and encoding logic, which the harness
  exercises directly against the same code the node runs.
- Honest caveat: the impact is off-chain only, and the field may be
  intentionally unused on-chain (all live clients leave it at 0). If the
  team considers receive `Amount` a vestigial field, the minimal fix is to
  stop displaying it in the explorer; if it is meant to be meaningful, it
  should be validated against `pending.Amount` and included in the
  canonical encoding. Either way, an unsigned, unvalidated field that the
  official UI presents as a received amount is a trust issue worth fixing.
- Suggested fix (trivial): in `validateAndAddReceive`, add
  `if b.Amount != pending.Amount { return error }`; and/or include
  `Amount` in the canonical encoding for `BlockReceive` (or remove the
  field from the struct and the explorer).
- No testnet-0005 interaction, no live XUSD, no local testnet, no other
  user's funds, keys, or workloads were touched.

### Thread

**Joseph Denne**team2026-11-15 11:08 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0060, 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-2543 and says what differs; it is read like any other.
