[Track 1 Bug Bounty] Directory-gossip panic still reproduces on master 9787859 — #15/#89 fix incomplete: unauthenticated remote node crash, gossip-propagated
Report
[Track 1 Bug Bounty] Directory-gossip panic still reproduces on master 9787859 — #15/#89 fix incomplete: unauthenticated remote node crash, gossip-propagated
Summary
The triage doc marks #15 ("POST /directory/register with 1-char node_peer panics every node (NodePeer[:12]). Remote, unauthenticated, propagates over gossip", rated Severe) and its duplicate #89 as Fixed: #1028 → #1029. The fix is incomplete: on the exact master the triage doc references (9787859, "release: testnet-0005 recovery phrase v2"), the vulnerable slice is still present and nothing guards it or recovers the goroutine.
node/node.go:2381 still slices reg.NodePeer[:12] unguarded inside handleDirectoryGossip, and directory.VerifyRegistration (directory/verify.go:29-53) plus the gossip topic validator (net/gossip_validate.go:143-157) only reject an empty node_peer — no minimum length exists anywhere in the path. A registration with a 1-character node_peer and a valid signature is accepted, published to the gossip topic, and panics every node that receives it — including nodes that never saw the HTTP request.
Live reproduction on master 9787859
Built xe from this commit, ran two nodes peered over libp2p (A: -port 9300 -api-port 9301; B dialed A via -dial, peer_count: 1 on both sides), then sent one HTTP request to A.
Craft a registration with node_peer = "a", signed by any fresh keypair (network id adopted from GET /node), and POST it to A:
network_id: testnet
account=f731da7f… node_peer="a" len=1
POST status: 200 OK {"ok":true}
Both nodes die. Node A (the POST target) and node B (the remote peer that received no HTTP request at all):
A: curl -s -m 3 http://127.0.0.1:9301/node → connection refused (DEAD)
B: curl -s -m 3 http://127.0.0.1:9401/node → connection refused (DEAD)
B log:
panic: runtime error: slice bounds out of range [:12] with length 1
goroutine 263 [running]:
github.com/xeprotocol/xe/node.(*Node).handleDirectoryGossip(0x121d1dc64a08, 0x121d1ddf5c00)
.../node/node.go:2381 +0x209
github.com/xeprotocol/xe/node.New.func30()
.../node/node.go:575 +0x72
created by github.com/xeprotocol/xe/node.New in goroutine 1
.../node/node.go:575 +0x36ed
Also reproduced single-node on ports 9101 and 9201 earlier in the session — three independent crashes, identical stack.
Affected code
node/node.go:2376-2384 — the panic site (goroutine spawned at node/node.go:575, no recover() anywhere on it):
func (n *Node) handleDirectoryGossip(regs <-chan *directory.Registration) {
for reg := range regs {
if err := n.Directory.Register(reg); err != nil {
logging.Warnf(...)
} else {
logging.Debugf("directory: accepted registration for %s on %s",
shortAddr(reg.Account), reg.NodePeer[:12]) // <-- panics when len(NodePeer) < 12
}
}
}
directory/verify.go:36-38 — the only length-adjacent check in the path:
if reg.NodePeer == "" {
return fmt.Errorf("missing node_peer")
}
net/gossip_validate.go:149-151 — the gossip validator, same gap:
if reg.Account == "" || reg.PubKey == "" || reg.Signature == "" || reg.NodePeer == "" {
return pubsub.ValidationReject
}
node/node.go:2429 — RegisterAccount republishes every accepted registration to the directory gossip topic, which is what carries the poisoned registration to peers.
Attack vectors
- HTTP: unauthenticated
POST /directory/registerwith a 1-charnode_peerand a valid self-signature.RegisterAccountrepublishes it to gossip. - Gossip-only: any peer can publish a crafted registration directly to the directory topic — the validator's non-empty checks pass, so no HTTP endpoint is involved at all. A single malicious peer crashes every node it can reach.
The HTTP endpoint's per-IP write-bucket rate limit (api/handler.go:314-322, 364-373) does not blunt either vector: the crash is single-shot, and the gossip-only path never touches the rate-limited endpoint.
Why this is not a duplicate of closed #15/#89
Both tickets are closed on the claim that #1029 fixed the panic. This report is evidence that the fix did not land on (or did not survive into) the referenced master: on 9787859 the slice at node/node.go:2381 is unguarded, VerifyRegistration and the gossip validator still accept any non-empty node_peer, and the goroutine at node/node.go:575 still has no recover(). The published tree is a single-commit snapshot, so #1029's diff cannot be quoted here — the tree itself is the evidence: nothing in it guards the path the closed tickets describe. The same argument covers the #14 missing-recover class: this goroutine is demonstrably not recovered on the referenced master.
Impact
Unauthenticated remote crash of any node, propagating to all peers over gossip — identical impact to #15 as originally rated (Severe), still present on the master the triage doc references. No fund or state loss (crash-restart only), so not claimed higher.
Suggested fix
Guard the slice and enforce a minimum peer-id length at validation time so bad registrations never enter the directory:
peer := reg.NodePeer
if len(peer) > 12 {
peer = peer[:12]
}
logging.Debugf("directory: accepted registration for %s on %s", shortAddr(reg.Account), peer)
plus a length check in VerifyRegistration / directoryValidator (a libp2p peer id is 52+ chars), and a recover() on the gossip goroutine as defense in depth.
Severity
Severe — remote, unauthenticated, network-wide availability loss, matching the original #15 ruling (anchor: #15's Severe, not the #14 panic family's Medium→High).
Affected version
master 9787859 (release: testnet-0005 recovery phrase v2) — the commit the triage doc cites as master while marking #15/#89 fixed.
Researcher: oxcode
Thread
Thank you for the follow-up. We have checked the public tree against the earlier ticket and are confirming the state of the fix across our builds; this ticket is being handled and we will update you here.