XE-13387 · Bounty
[SDK] src/attestation.ts wraps out-of-range int64 timestamps, evicts honest timekeeper endpoints on /node spoofing, and accepts duplicate-key quorums
Report
Summary
src/attestation.ts diverges from Go ledger consensus (core/attestation.go) and allows quorum/discovery bypasses across four coupled paths:
- Out-of-range
int64timestamp wrapping inattestationPayload,verifyAttestation, andattestedTime:- Go consensus (
core/attestation.go) strictly enforces0 <= timestamp <= math.MaxInt64(9223372036854775807). attestationPayloadcalledu64be(BigInt.asUintN(64, timestamp))without bounds checks, silently wrapping negative timestamps (-1n->0xffffffffffffffff) and timestamps> MAX_INT64into two's-complement 8-byte payloads thatverifyAttestationaccepted astrueandattestedTimeincorporated into median calculation, producing blocks rejected on-chain.
- Go consensus (
- Timekeeper discovery DoS via
/nodepublic_keyspoofing and case-sensitive key matching:discoverTimekeepersmatchedset.keyscase-sensitively and deduplicated discovered candidates solely byseen.has(t.publicKey). An untrusted candidate URL listed earlier incandidatesthat returned an honest timekeeper'spublic_keyfrom/node(without holding the private key) evicted the real timekeeper's endpoint URL from the returnedTimekeeper[]list, causing subsequentgatherAttestationssignature verification to fail even though the honest timekeeper URL was passed.
- Duplicate-key quorum inflation & missing
set.thresholdbounds ingatherAttestations:gatherAttestationscheckedtimekeepers.length < set.thresholdinstead of counting distinct trustedpublicKeys (set.keys), did not validate1 <= set.threshold <= MAX_ATTESTATIONS_PER_BLOCK(20), did not filter caller-suppliedTimekeeper[]againstset.keys, and did not deduplicate returnedAttestation[]by normalizedpublicKey. Passing twoTimekeeperentries backed by the same key (or mirrors of one node) satisfiedatts.length >= set.thresholdwith duplicate attestations from a single key, which Go consensus rejects as duplicate timekeeper attestations.
Impact
- Consensus rejection / invalid lease settlement blocks: Out-of-range
biginttimestamps or duplicate-key attestations pass SDK helpers and fail Go node block validation. - Availability / failover DoS: Any spoofed candidate endpoint claiming a known
public_keyin/nodeshadows honest endpoints for that timekeeper during discovery; uppercase hex keys inTimekeeperSetor/noderesponses fail discovery/verification.
Fix
- Enforce
0n <= timestamp <= MAX_INT64((1n << 63n) - 1n) inattestationPayload,verifyAttestation, andattestedTime. - Normalize public keys to lowercase hex in
discoverTimekeepersand deduplicate by${publicKey}@${client.url}so spoofed/nodeendpoints cannot evict honest failover endpoints. - Validate
1 <= set.threshold <= MAX_ATTESTATIONS_PER_BLOCK(20), filtertimekeepersagainstset.keys, requiredistinctKeys.size >= set.thresholdbefore network fan-out, verify normalizedatt.publicKeyagainst bothtk.publicKeyandset.keys, deduplicate valid attestations perpublicKey, and cap atMAX_ATTESTATIONS_PER_BLOCK.
Thread
Khanhtnq2026-11-13 10:39 UTCgithub
Fix opened in https://github.com/xeprotocol/sdk/pull/16.
Joseph Denneteam2026-11-20 13:00 UTCgithub
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-13387 and says what differs; it is read like any other.