[node] Unauthenticated remote node crash via nil block in ledger-sync response (requestSync dereferences nil block, no recover)
Report
Summary
A remote, unauthenticated peer can crash any node that syncs the ledger from it by answering a ledger-sync request with a response containing a JSON null block. The sync client dereferences the nil *core.Block and panics; there is no recover() anywhere on the sync-client path, so the panic kills the node process.
Severity
High. Unauthenticated remote node crash (availability). No stake, key, funds, or privileged position required — any peer the victim syncs from can do it, and sync is automatic on every new connection and periodically thereafter. Claimed tier: high.
Evidence (code-level, xe repo HEAD 89a542e)
net/sync.go:529requestSync: decodes pages intoSyncResponse{Blocks []*core.Block}and appends them verbatim:allBlocks = append(allBlocks, resp.Blocks...)— a JSONnullelement becomes a nil*core.Blockand is never checked.net/sync.go:592quarantine filter:for _, b := range allBlocks { if quarantine.contains(b.Hash) { ... } }—b.Hashon a nil block is a nil-pointer dereference.- The same nil block would also panic one line deeper:
core/ledger.goaddBlockstarts withbc := *b. - No recover on the whole path:
gate.spawn(net/sync.go:403-412) runs the callback bare; theConnectedFhandler (net/sync.go:320-343) and the periodic resync (net/sync.go:345-395) both callrequestSyncdirectly. An unrecovered panic in any of these goroutines is fatal to the process. - The sibling code already knows about this shape and guards it:
net/blocksync.goPullBlocksskips nil blocks (if b == nil { continue }).requestSyncis the unguarded copy.
Reproduction (runnable PoC, passes against HEAD 89a542e)
Test net/zz_r5_nilblock_test.go (TestR5LedgerSyncNilBlockCrash, package net): two in-process libp2p hosts; the "attacker" host serves protocol /xe/sync/1.0.0 and answers the victim's SyncRequest with {"blocks":[null],"has_more":false}; the victim calls requestSync against it. Result:
=== RUN TestR5LedgerSyncNilBlockCrash
requestSync panicked as expected: runtime error: invalid memory address or nil pointer dereference
--- PASS: TestR5LedgerSyncNilBlockCrash (0.03s)
Unrecovered stack (same test without the recover wrapper):
panic: runtime error: invalid memory address or nil pointer dereference
github.com/xeprotocol/xe/net.requestSync(...)
/home/hatch/workspace/bounty-hunting/xe-bounty/work/xe-repo/net/sync.go:592
go test ./net/ -run TestR5LedgerSyncNilBlockCrash -v reproduces it. No mainnet/testnet nodes were touched — the crash was demonstrated locally only.
Impact
- Any node that syncs ledger state from a malicious peer crashes. Sync runs automatically when a peer connects and on the periodic resync, so the attacker only has to be a peer of the victim (discovery is ambient: DHT rendezvous + mDNS + bootstrap dials).
- After a restart the node re-syncs and can be crashed again by the same peer, so this is a repeatable availability kill, not a one-off.
- Affected parties: every node operator on the network (providers, representatives, plain nodes). No funds are at risk directly, but a crashed representative stops voting and a crashed provider stops serving leases.
Remediation
Skip nil blocks in requestSync exactly as PullBlocks already does (if b == nil { continue }), ideally in both the decode loop and the quarantine filter; and/or add a recover() around the sync-client goroutines (gate.spawn) so one bad peer cannot kill the process. A nil check in Ledger.addBlock / AddSyncedBlock would harden the shared entry point too.
Dedup note
This is the LEDGER-sync instance, not the statechain one. XE-4845 ("[High] Unauthenticated remote node crash via nil block in statechain-sync response") covers statechain/sync.go (/xe/statechain-sync/1.0.0) only — different file, different protocol, different trigger. Board API queries before filing, all clean for this path: q=nil+block returns XE-4845 (statechain), XE-0436, XE-7692 (both unrelated); q=null+block, q=requestSync+panic, q=ledger+sync+crash, q=nil+panic return 0 tickets; q=sync+crash returns XE-2821 and XE-0002 (unrelated). No ticket mentions a nil block in net/sync.go requestSync.
Scope note
In scope: everything shipping with the XE node and everything the public testnet runs (bounty policy, test.network/bounty). Node repo xeprotocol/xe, HEAD 89a542e.
Environment
xe repo HEAD 89a542e ("release: testnet-0005 quorum withhold fix"), audited 2026-11-12. PoC run locally with Go 1.25.4, go test ./net/ -run TestR5LedgerSyncNilBlockCrash -v.
Payout address (XE)
xe:952f5eaffd7af01d1c452ea68f2b37ed340ab773ed6ae4fb73c18fb2ef4edc8d
Thread
Thanks. This is the same finding as https://bounty.xe.network/XE-0002, 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-7924 and says what differs; it is read like any other.