{"id":"XE-16841","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"670","source_url":"https://github.com/xeprotocol/xe/issues/670","reporter_id":2920,"title":"[Low] VerifyMultisig verifies every attached signature with no early exit and no cap","area":"consensus","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:33:15.223546+00:00","updated_at":"2026-11-22T23:26:12.199722+00:00","source_created_at":"2026-11-17T06:32:29+00:00","told_at":"2026-11-22T23:26:12.240081+00:00","status_changed_at":"2026-11-22T23:26:12.212218+00:00","url":"https://bounty.xe.network/XE-16841","body":"## Summary\n\n`VerifyMultisig` verifies every attached signature even after the threshold is already met, and nothing caps how many signatures a block may carry. A block with ~1,200 signatures costs each verifying node ~200 ms of CPU per `AddBlock` (verification runs twice), vs ~0.24 ms for a normal 2-signature block.\n\n## Root cause\n\n`VerifyMultisig` (`core/multisig.go:73-117`) verifies all signatures in the loop and only checks `validCount < ks.Threshold` afterwards — no break once the threshold is met, unlike `VerifyMultisigAny` (`:119-144`) which returns on the first valid sig. Nothing caps the signature count anywhere (`addBlock`, gossip validator, API) — only the 256 KiB gossip / 1 MiB API message limits bound it (~1,200 sigs fit in a gossip message).\n\n## Verification\n\nMeasured benchmark (1,200 valid sigs, threshold 2): attacker signing cost ~44-70 ms, victim `VerifyMultisig` cost ~99-130 ms per call — and verification runs twice per `AddBlock` (once in `addBlock` `:856`, once in `dispatchValidateAndAdd` `:979`), so ~200 ms victim CPU per block per node (~4.5x per-node amplification, plus gossip fan-out). 2-sig baseline: ~231-238 µs. Early exit is safe: signatures are not part of the block hash, so an extra unvalidated signature is inert.\n\nCaveat, stated honestly: modest impact — requires an attacker-owned large keyset and roughly symmetric signing cost; the amplification is mostly the double verification + fan-out.\n\n## Note on related reports\n\nNo existing report covers this. Searched `VerifyMultisig threshold signatures`, `too many signatures multisig`, `signature verification DoS`, `unbounded signatures`. #609 (malformed signer pubkey crash), #506/#614 (lease ops need 1 sig), #394/#552 (gossip drops multisig) are different issues.\n\n## Suggested fix\n\nBreak out of the loop once `validCount == ks.Threshold` (and/or cap attached signatures, e.g. at keyset size).","patch_refs":[],"thread":[{"id":18806,"source":"desk","source_ref":"reply:16483","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16841 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:12.199722+00:00"}]}