<!-- XE-7924 · [node] Unauthenticated remote node crash via nil block in ledger-sync response (requestSync dereferences nil block, no recover) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-7924>. The page is the record; this is the same page for reading.*

XE-7924 · Bounty

# \[node\] Unauthenticated remote node crash via nil block in ledger-sync response (requestSync dereferences nil block, no recover)

Closed · duplicate
—claimed High
web
filed 2026-11-11 19:23 UTC
by xe:952f5eaf

Verdict
:   Duplicate

Tier
:   —

Claimed
:   High

Area
:   P2P / sync

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

Tracked
:   internally

Updated
:   2026-11-17 09:38 UTC

Told
:   2026-11-17 09:38 UTC

### Patches

None linked.

### History

- [415026](https://bounty.xe.network/log/415026) 2026-11-17 09:38 UTC proposal.adopted
- [415025](https://bounty.xe.network/log/415025) 2026-11-17 09:38 UTC reply.sent
- [415024](https://bounty.xe.network/log/415024) 2026-11-17 09:38 UTC ticket.status accepted → closed
- [412813](https://bounty.xe.network/log/412813) 2026-11-17 09:37 UTC ticket.status triaging → accepted
- [412812](https://bounty.xe.network/log/412812) 2026-11-17 09:37 UTC ticket.status new → triaging
- [412313](https://bounty.xe.network/log/412313) 2026-11-17 09:37 UTC proposal.adopted
- [412312](https://bounty.xe.network/log/412312) 2026-11-17 09:37 UTC ticket.facts area
- [412311](https://bounty.xe.network/log/412311) 2026-11-17 09:37 UTC proposal.adopted
- [412310](https://bounty.xe.network/log/412310) 2026-11-17 09:37 UTC ticket.facts
- [412309](https://bounty.xe.network/log/412309) 2026-11-17 09:37 UTC proposal.adopted
- [412308](https://bounty.xe.network/log/412308) 2026-11-17 09:37 UTC ticket.facts
- [412307](https://bounty.xe.network/log/412307) 2026-11-17 09:37 UTC proposal.adopted

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

### 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:529` `requestSync`: decodes pages into `SyncResponse{Blocks []*core.Block}` and appends them verbatim: `allBlocks = append(allBlocks, resp.Blocks...)` — a JSON `null` element becomes a nil `*core.Block` and is never checked.
- `net/sync.go:592` quarantine filter: `for _, b := range allBlocks { if quarantine.contains(b.Hash) { ... } }` — `b.Hash` on a nil block is a nil-pointer dereference.
- The same nil block would also panic one line deeper: `core/ledger.go` `addBlock` starts with `bc := *b`.
- No recover on the whole path: `gate.spawn` (`net/sync.go:403-412`) runs the callback bare; the `ConnectedF` handler (`net/sync.go:320-343`) and the periodic resync (`net/sync.go:345-395`) both call `requestSync` directly. 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.go` `PullBlocks` skips nil blocks (`if b == nil { continue }`). `requestSync` is 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

**Joseph Denne**team2026-11-17 09:38 UTCdesk

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.
