[Medium] Ledger sync page decode fails on giant multisig blocks (uncapped signature count)
Report
Summary
There is no cap on the number of signatures on a multisig block and no on-chain block size limit for ledger blocks, so a single attacker can create blocks so large that ledger sync breaks: the server serves sync pages count-capped at 256 blocks with no byte cap, and the client decodes each page through a 10 MiB limit — a page of giant blocks fails to decode, the whole round is discarded, and the retry every 10s fails the same way while the giant blocks remain unobtained.
Root Cause
- Producer side: no cap on
len(b.Signatures)anywhere in the ledger validation path (onlylen > 0checks,core/ledger.go:1479,core/crypto.go:120,158) and no cap on keyset size inValidateKeyset(core/multisig.go:35-60: only non-empty, threshold ≥1, threshold ≤ key count, 64-hex keys, no duplicates). EachBlockSignatureis ~230 bytes JSON (core/types.go:58-61). No on-chain block size limit exists for ledger blocks (unlike statechain's MaxBlockSize). - Consumer side: server serves sync pages count-capped at 256 blocks/page (
maxPageSize,net/sync.go:28) with NO byte cap; client decodes each page throughio.LimitReader(s, maxSyncResponseBytes=10MB)(net/sync.go:40,724-735) andrequestSyncreturns error on decode failure, discarding the whole round (retried every 10s, failing every time while the giant blocks remain unobtained). - Blocks up to 1MB are submittable via the official API (
maxRequestBytes = 1<<20,api/handler.go:522); larger ones are addable by an attacker on their own node directly. Gossip caps at 256KB/message (MaxGossipMessageSize,net/gossip.go:27), so giant blocks propagate only via sync — and then break sync.
Verification
Executed PoC (in-package net test):
giant multisig open: signatures=500 jsonBytes=146296 (gossip cap 262144, API cap 1048576)
sync page: blocks=100 bytes=14629729 maxSyncResponseBytes=10485760
requestSync-style decode of giant page: err=unexpected EOF
control: 1-block page (146326 bytes) decodes OK, blocks=1
Note on related reports
Searched "sync page 10MB decode multisig signatures", "multisig signature count cap block size", "sync page decode fails large block" — no hits. Distinct from #684 (block_request 64 KiB messenger cap, different protocol/cap) and #670 (verify cost, not size).
Suggested fix
Cap the signature count per block (and/or keyset size) in ledger validation, and add a byte cap to sync pages (serve fewer blocks when they are large) so a page can never exceed what the client can decode.
Thread
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-16983 and says what differs; it is read like any other.