{"id":"CVE-2026-58262","aliases":["CVE-2026-58262","GHSA-f9h7-4mmq-vgcq"],"related":[],"kind":"vulnerability","state":"published","title":"Klever-Go: PubKeysBitmap padding bits bypass the BLS signature quorum","summary":"Klever-Go is the Go implementation of the Klever blockchain protocol. Prior to 1.7.20, header signature verification counts the unused padding bits of the PubKeysBitmap toward the two-thirds validator quorum. These padding bits do not correspond to any validator and are ignored by the actual BLS aggregate-signature check, so a malicious or compromised block producer can set them to reach the required quorum while gathering fewer genuine validator signatures than the protocol demands. As a result, nodes that import or intercept the header accept it as correctly signed without a real two-thirds quorum, weakening consensus safety and undermining finality. This issue is fixed in version 1.7.20.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Klever-Go is the Go implementation of the Klever blockchain protocol. Prior to 1.7.20, header signature verification counts the unused padding bits of the PubKeysBitmap toward the two-thirds validator quorum. These padding bits do not correspond to any validator and are ignored by the actual BLS aggregate-signature check, so a malicious or compromised block producer can set them to reach the required quorum while gathering fewer genuine validator signatures than the protocol demands. As a result, nodes that import or intercept the header accept it as correctly signed without a real two-thirds quorum, weakening consensus safety and undermining finality. This issue is fixed in version 1.7.20.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nWhen validating an incoming block header, `HeaderSigVerifier.verifyConsensusSize` counts *every* set bit in `PubKeysBitmap` — including bits that correspond to no validator (the padding bits of the final byte, which exist whenever the consensus group size is not a multiple of 8). The subsequent BLS aggregate-signature verification (`blsMultiSigner.Verify`) only checks signature validity for real validator indices and silently ignores those padding bits. As a result, a malicious or compromised block producer can set the padding bits to make the on-bits reach the PBFT quorum while only gathering a smaller number of real validator signature shares, causing a block to be accepted as correctly signed without a genuine two-thirds validator quorum.\n\n## Details\n\nQuorum counter counts padding bits — `core/process/headerCheck/headerSignatureVerify.go:145-183`:\n\n```go\nfunc (hsv *HeaderSigVerifier) verifyConsensusSize(consensusPubKeys []string, header data.HeaderHandler) error {\n\tconsensusSize := len(consensusPubKeys)\n\tbitmap := header.GetPubKeysBitmap()\n\n\texpectedBitmapSize := consensusSize / 8\n\tif consensusSize%8 != 0 {\n\t\texpectedBitmapSize++\n\t}\n\tif len(bitmap) != expectedBitmapSize {\n\t\t...\n\t\treturn ErrWrongSizeBitmap\n\t}\n\n\tnumOfOnesInBitmap := 0\n\tfor index := range bitmap {\n\t\tnumOfOnesInBitmap += bits.OnesCount8(bitmap[index])   // <-- counts ALL bits incl. padding\n\t}\n\n\tminNumRequiredSignatures := consensus.GetPBFTThreshold(consensusSize)\n\t...\n\tif numOfOnesInBitmap >= minNumRequiredSignatures {\n\t\treturn nil\n\t}\n\t...\n\treturn ErrNotEnoughSignatures\n}\n```\n\nThe bitmap-byte-length check above only ensures the byte array is the right *size*; it never requires the padding bits (bits `[consensusSize … expectedBitmapSize*8)`) to be zero. So any combination of padding bits is accepted toward the quorum.\n\n`VerifySignature` (`:92-143`) then builds the verifier from the *real* public keys, sets the aggregate signature, and calls `verifier.Verify(hash, bitmap)`.\n\nThe BLS verifier ignores padding bits — `crypto/signing/multisig/blsMultisig.go:272-297`:\n\n```go\nfunc (bms *blsMultiSigner) Verify(message []byte, bitmap []byte) error {\n\t...\n\tmaxFlags := len(bitmap) * 8\n\tflagsMismatch := maxFlags < len(bms.data.pubKeys)   // only rejects *too few* bytes\n\tif flagsMismatch {\n\t\treturn crypto.ErrBitmapMismatch\n\t}\n\n\tpubKeys := make([]crypto.PublicKey, 0)\n\tfor i := range bms.data.pubKeys {                    // <-- only real validator indices\n\t\terr := bms.isIndexInBitmap(uint16(i), bitmap)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tpubKeys = append(pubKeys, bms.data.pubKeys[i])\n\t}\n\n\treturn bms.llSigner.VerifyAggregatedSig(bms.keyGen.Suite(), pubKeys, bms.data.aggSig, message)\n}\n```\n\nBecause the loop only walks `range bms.data.pubKeys`, a bit set at position `i >= len(pubKeys)` is never inspected by `isIndexInBitmap` and is therefore silently dropped from signature verification, even though `verifyConsensusSize` already counted it toward quorum.\n\nPBFT threshold — `core/consensus/consensus.go:5-8` (`consensusSize*2/3 + 1`) and fallback `:10-13` (`consensusSize/2 + 1`).\n\nReachable from received blocks — `core/process/block/interceptedBlocks/interceptedBlock.go:181-201` runs `CheckValidity()` → `VerifySignature` on every header received from peers.\n\n### Worked example (consensus size = 5)\n\n- Required PBFT quorum: `5*2/3 + 1 = 4`.\n- Valid validator bit positions: 0..4. Bits 5, 6, 7 are padding (no validator).\n- Attacker gathers only **one** real signature share (validator 0) and aggregates it.\n- Sets bitmap byte to `0b1110_0001` (`0xE1`): bit 0 (real) + bits 5, 6, 7 (padding).\n- `verifyConsensusSize` sees `bits.OnesCount8(0xE1) = 4` ≥ 4 → passes quorum.\n- `blsMultiSigner.Verify` only validates against validator 0's public key (padding ignored) → passes.\n- The block is accepted with one real signer instead of four.\n\nFor any `consensusSize` not divisible by 8, up to `8 - (consensusSize % 8)` fake \"padding\" signatures can be counted toward quorum. On a 21-member group (one padding bit) the attacker shaves one vote; on smaller/sharded groups with `consensusSize % 8` close to 7 the relative impact is larger.\n\n## PoC\n\nReproduced locally against current `develop` (`085a5d1`) with this test (run under `core/process/headerCheck`, removed after verification):\n\n```go\nfunc TestPOCHeaderSigVerifierCountsPaddingBitsTowardQuorum(t *testing.T) {\n\targs := createHeaderSigVerifierArgs()\n\targs.NodesCoordinator = &cMock.NodesCoordinatorMock{\n\t\tGetValidatorsPublicKeysCalled: func(_ []byte, _ uint64, _ uint32) ([]string, error) {\n\t\t\treturn []string{\"pk0\", \"pk1\", \"pk2\", \"pk3\", \"pk4\"}, nil // consensus size 5 -> need 4\n\t\t},\n\t}\n\tverifyCalled := false\n\targs.MultiSigVerifier = &cMock.BelNevMock{\n\t\tCreateMock: func(pubKeys []string, index uint16) (crypto.MultiSigner, error) {\n\t\t\treturn &cMock.BelNevMock{\n\t\t\t\tVerifyMock: func(msg []byte, bitmap []byte) error {\n\t\t\t\t\tverifyCalled = true          // verifier is reached even though only 1 real signer bit is set\n\t\t\t\t\trequire.Equal(t, []byte{0xe1}, bitmap)\n\t\t\t\t\treturn nil                  // single-signer aggregate verifies OK\n\t\t\t\t},\n\t\t\t}, nil\n\t\t},\n\t}\n\thdrSigVerifier, _ := headerCheck.NewHeaderSigVerifier(args)\n\theader := &block.Block{\n\t\tHeader:        &block.BlockHeader{PrevRandSeed: []byte(\"seed\")},\n\t\tPubKeysBitmap: []byte{0xe1}, // bit0 (real) + padding bits 5,6,7 => counted as 4/5 quorum\n\t\tSignature:     []byte(\"aggregate-of-only-real-bit-0\"),\n\t}\n\terr := hdrSigVerifier.VerifySignature(header)\n\trequire.NoError(t, err)   // <-- accepted with 1 real signature instead of the required 4\n\trequire.True(t, verifyCalled)\n}\n```\n\nRun: `go test ./core/process/headerCheck -run TestPOCHeaderSigVerifierCountsPaddingBitsTowardQuorum -count=1` → `ok`. The test asserts the current code accepts the header; a corrected implementation must return an error because only one real signer bit is set.\n\n## Impact\n\nThis is an improper-verification / consensus-integrity vulnerability. A block proposer who can produce a valid leader signature plus a single valid aggregate BLS signature share can still satisfy the block-level quorum check by populating the padding bits of `PubKeysBitmap`. This weakens the PBFT two-thirds assumption: blocks can be accepted with fewer honest validator signatures than the protocol requires, enabling acceptance of attacker-favored blocks under collusion/compromise below the intended threshold and undermining finality guarantees. Any node that imports/intercepts headers (`interceptedBlock.CheckValidity`) is affected. Note the attacker still needs at least one valid consensus-group signature share and a valid leader signature, hence `PR:L` / `AC:H`.\n\n## Suggested fix\n\nIn `verifyConsensusSize`, count only bits whose index `< consensusSize` and additionally reject any non-zero bit in the padding region of the final bitmap byte (i.e. mask the last byte with `(1 << (consensusSize % 8)) - 1` before counting, and fail if the original last byte has bits set above that mask). Mirror the same padding-bit rejection in `blsMultiSigner.Verify` so the verifier fails closed rather than silently ignoring unknown bits.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Klever-Go es la implementación en Go del protocolo de cadena de bloques Klever. Antes de la versión 1.7.20, la verificación de la firma de la cabecera cuenta los bits de relleno no utilizados de PubKeysBitmap para el quórum de validadores de dos tercios. Estos bits de relleno no corresponden a ningún validador y son ignorados por la verificación real de la firma agregada BLS, por lo que un productor de bloques malicioso o comprometido puede configurarlos para alcanzar el quórum requerido mientras reúne menos firmas de validadores genuinas de las que exige el protocolo. Como resultado, los nodos que importan o interceptan la cabecera la aceptan como correctamente firmada sin un quórum real de dos tercios, debilitando la seguridad del consenso y socavando la finalidad. Este problema se corrige en la versión 1.7.20.","source":"nvd"}],"published":"2026-08-07T22:00:57.154Z","modified":"2026-11-23T21:00:55.870Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N","score":7.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-345","CWE-347"],"affected":[{"ranges":[{"version":"< 1.7.20","status":"affected"}],"vendor":"klever-io","product":"klever-go","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.7.20"}],"ecosystem":"Go","package":"github.com/klever-io/klever-go","purl":"pkg:golang/github.com/klever-io/klever-go","source":"ghsa"}],"references":[{"url":"https://github.com/klever-io/klever-go/security/advisories/GHSA-f9h7-4mmq-vgcq","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/klever-io/klever-go/commit/a11cb28e495e608d8034dbe83a91e89d0c68e0f7","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-58262","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/klever-io/klever-go","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-12T22:08:08.809Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-58262","url":"https://www.cve.org/CVERecord?id=CVE-2026-58262","licence":"CVE Terms of Use","modified":"2026-08-12T22:15:20.657Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f9h7-4mmq-vgcq","url":"https://github.com/advisories/GHSA-f9h7-4mmq-vgcq","licence":"CC-BY-4.0","modified":"2026-11-23T21:00:55.870Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-58262","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-58262","licence":"Public domain","modified":"2026-10-24T16:10:00.153Z"}],"updatedAt":"2026-11-25T22:59:31.898Z","epss":{"score":0.00158,"percentile":0.05211,"date":"2026-12-01T12:00:22.000Z"}}