[Low] VerifyMultisig verifies every attached signature with no early exit and no cap
Report
Summary
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.
Root cause
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).
Verification
Measured 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.
Caveat, stated honestly: modest impact — requires an attacker-owned large keyset and roughly symmetric signing cost; the amplification is mostly the double verification + fan-out.
Note on related reports
No 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.
Suggested fix
Break out of the loop once validCount == ks.Threshold (and/or cap attached signatures, e.g. at keyset size).
Thread
Thanks. This is the same finding as an earlier report that is not public, 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-16841 and says what differs; it is read like any other.