<!-- XE-0092 · [Medium] VerifyMultisigAny ignores Keyset.Threshold - lease family authorised by 1-of-N (supporting #6/#93, PRs #7/#110 unmerged) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0092>. The page is the record; this is the same page for reading.*

XE-0092 · Bounty

# \[Medium\] VerifyMultisigAny ignores Keyset.Threshold \- lease family authorised by 1-of-N (supporting #6/#93, PRs #7/#110 unmerged)

Closed · duplicate
—claimed Medium
[xe#152](https://github.com/xeprotocol/xe/issues/152)
filed 2026-10-29 00:54 UTC
by Induksupp

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   —

Duplicate of
:   [XE-0068](https://bounty.xe.network/XE-0068) closed

Tracked
:   —

Updated
:   2026-11-10 00:11 UTC

Told
:   2026-11-05 22:05 UTC

### Patches

None linked.

### History

- [8934](https://bounty.xe.network/log/8934) 2026-11-05 22:06 UTC github.state\_pushed
- [8933](https://bounty.xe.network/log/8933) 2026-11-05 22:06 UTC github.labels
- [8931](https://bounty.xe.network/log/8931) 2026-11-05 22:05 UTC reply.mirrored
- [8889](https://bounty.xe.network/log/8889) 2026-11-05 22:05 UTC reply.sent
- [8888](https://bounty.xe.network/log/8888) 2026-11-05 22:05 UTC proposal.adopted
- [8887](https://bounty.xe.network/log/8887) 2026-11-05 22:05 UTC proposal.adopted
- [8886](https://bounty.xe.network/log/8886) 2026-11-05 22:05 UTC ticket.status new → closed
- [8885](https://bounty.xe.network/log/8885) 2026-11-05 22:05 UTC proposal.adopted
- [8884](https://bounty.xe.network/log/8884) 2026-11-05 22:05 UTC ticket.facts
- [8883](https://bounty.xe.network/log/8883) 2026-11-05 22:05 UTC proposal.adopted
- [8882](https://bounty.xe.network/log/8882) 2026-11-05 22:05 UTC ticket.facts
- [7132](https://bounty.xe.network/log/7132) 2026-11-05 14:02 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-0092) · [JSON](https://bounty.xe.network/v1/tickets/XE-0092) · [markdown](https://bounty.xe.network/XE-0092.md)

### Report

## Summary

`VerifyMultisigAny` (`core/multisig.go:114-138`) accepts **any single** valid signature from a keyset member and never compares against `Keyset.Threshold`. Because `IsSpendingOp` (`core/multisig.go:140-147`) omits `lease_accept`, `lease_settle`, `lease_cancel` and `lease_force_settle`, all four of those fund-moving operations take that weak path in `verifyBlockCredential` (`core/ledger.go:1436-1442`).

Net effect on a 2-of-2 multisig account: **one** compromised signer can accept a lease, cancel a lease, or settle a lease unilaterally, while a plain `send` on the same account correctly demands both signatures.

**Suggested severity:** Medium (2,500 XE) \- validation gap. I am filing this as supporting evidence for the existing reports rather than as a new discovery; see "Relationship to existing issues" below.

## Relationship to existing issues (please read before triaging)

I want to be explicit that this is **not** a new finding:

- **#93** already reports `lease_accept` bypassing the multisig threshold, and **#110** is an open PR fixing exactly that.
- **#6** (section 1, item 2\) already reports all four lease types missing from `IsSpendingOp`, and **#7** is an open PR claiming to fix them.

What I am adding that is not in either report:

1. **`VerifyMultisigAny` isolated as a defective primitive.** Neither #6 nor #93 tests the function directly. Both describe the symptom at the call site. The function itself is the defect: it returns `nil` on the first valid signature and never reads `ks.Threshold` (line 133-135). Any future block type that is not added to `IsSpendingOp` inherits the same 1-of-N bypass silently. A regression test pinned to the primitive would catch that class of mistake; a test pinned to `lease_accept` would not.
2. **Proof that the pending PRs are not merged and the bug is still live.** Both #7 and #110 are `state: open` as of 2026-10-29. Master is still `9787859` (2026-10-15), and `git log -S 'BlockLeaseAccept' -- core/multisig.go` returns nothing. I verified this against a fresh `git clone --depth 1` of master, not just my local copy.
3. **A differential test** showing `VerifyMultisig` and `VerifyMultisigAny` disagreeing on byte-identical input, which makes the intent gap unambiguous.

If the team considers this a duplicate of #93, that is a fair call and I would rather it be closed as such than padded. The `VerifyMultisigAny` primitive test is the part I would ask to be kept regardless.

## Affected code

`core/multisig.go:114-138`

```
func VerifyMultisigAny(hash string, sigs []BlockSignature, ks *Keyset) error {
	if len(sigs) == 0 {
		return fmt.Errorf("no signatures")
	}
	...
	for _, sig := range sigs {
		if !keysetMap[sig.PublicKey] {
			continue
		}
		if err := VerifyHexSignature(sig.PublicKey, sig.Sig, hashBytes); err == nil {
			return nil          // <-- ks.Threshold is never consulted
		}
	}
	return fmt.Errorf("no valid signature from any keyset member")
}
```

`core/multisig.go:140-147`

```
func IsSpendingOp(t BlockType) bool {
	switch t {
	case BlockSend, BlockBurn, BlockLease, BlockLeaseRenew,
	     BlockMultisigOpen, BlockMultisigUpdate, BlockMint:
		return true
	default:
		return false           // <-- lease_accept/settle/cancel/force_settle land here
	}
}
```

`core/ledger.go:1436-1442`

```
if IsSpendingOp(b.Type) {
	if err := VerifyMultisig(b.Hash, b.Signatures, ks); err != nil {   // threshold enforced
		return fmt.Errorf("multisig: %w", err)
	}
	return nil
}
if err := VerifyMultisigAny(b.Hash, b.Signatures, ks); err != nil {   // 1-of-N accepted
	return fmt.Errorf("multisig: %w", err)
}
```

## Reproduction

Repository: `github.com/xeprotocol/xe` @ master `9787859`.
Environment: Go 1.24.3, Linux x86-64.

The signature material is real ed25519, generated with `openssl genpkey -algorithm ed25519` and signed over the 32-byte digest `f9c195734f05a628640961c117eb7b4aa616e95251080dcc8f9f5688a7842e4c`. No dummy hex, no mocked verifier.

Keyset under test: 3-of-5, threshold 3\.

```
keys[0] = 334610fc39650a013e2ec6e767f018f45c38a21956b8bb94bbae8ae3e41859e4
keys[1] = 404f5bc1f208b4b80c931a6f32619d6ea6accc58372f2e419cec99ca2d520f4f
keys[2] = afe99c7ae6e8dc2d2d67ce289bbb46d46fd4908360a481cee613b8874144418e
keys[3] = 5a2c2a1cff8e0c2a168358ceef3fd53b4e22ecac274770ed8968d59b6d3dca3c
keys[4] = 58c0159266ff3697c8c646df7b806095a6d41fa208cc9c8c50316cbcacbb16aa
```

One valid signature from `keys[0]`:

```
sig = 46ba415b70375f75d6734c579799a3b52953f4beee97801f8238a767b577ce05
      da69ad83d3a2633a03813520276b2f617aa61b72ae365497cb83f188c0b3f508
```

### Observed

```
VerifyMultisigAny(1 valid sig, threshold=3) -> ACCEPTED
VerifyMultisig(1 valid sig, threshold=3)    -> rejected: insufficient signatures: got 1, need 3
  => the two paths disagree on identical input

IsSpendingOp(lease_accept)      = false
IsSpendingOp(lease_settle)      = false
IsSpendingOp(lease_cancel)      = false
IsSpendingOp(lease_force_settle)= false
IsSpendingOp(receive)           = false
```

### End-to-end control through the real Ledger

To confirm the threshold is genuinely enforced elsewhere, the same test opens a real 2-of-2 multisig account (fresh keypair per run, so the address differs each time) and then submits a `send` signed by only one member:

```
2-of-2 multisig account opened: <fresh address per run>
control (send, 1-of-2 sig) -> REJECTED: multisig: insufficient signatures: got 1, need 2
  => send correctly enforces the threshold
```

So the ledger is capable of enforcing the threshold; the lease family simply never reaches that check.

### Repetitions

Three consecutive runs, all PASS, all producing identical output:

| \# | Condition | Result |
| --- | --- | --- |
| 1 | local clone, `go test -count=1` | PASS |
| 2 | after `go clean -testcache`, full rebuild | PASS |
| 3 | fresh `git clone --depth 1` of master into a clean directory | PASS |

### Test file

```
package core_test

import (
	"testing"

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

func TestMedium_LeaseAcceptBypassesMultisigThreshold(t *testing.T) {
	ks := &core.Keyset{Keys: []string{
		"334610fc39650a013e2ec6e767f018f45c38a21956b8bb94bbae8ae3e41859e4",
		"404f5bc1f208b4b80c931a6f32619d6ea6accc58372f2e419cec99ca2d520f4f",
		"afe99c7ae6e8dc2d2d67ce289bbb46d46fd4908360a481cee613b8874144418e",
		"5a2c2a1cff8e0c2a168358ceef3fd53b4e22ecac274770ed8968d59b6d3dca3c",
		"58c0159266ff3697c8c646df7b806095a6d41fa208cc9c8c50316cbcacbb16aa",
	}, Threshold: 3}

	hash := "f9c195734f05a628640961c117eb7b4aa616e95251080dcc8f9f5688a7842e4c"
	one := []core.BlockSignature{{
		PublicKey: "334610fc39650a013e2ec6e767f018f45c38a21956b8bb94bbae8ae3e41859e4",
		Sig: "46ba415b70375f75d6734c579799a3b52953f4beee97801f8238a767b577ce05da69ad83d3a2633a03813520276b2f617aa61b72ae365497cb83f188c0b3f508",
	}}

	if err := core.VerifyMultisigAny(hash, one, ks); err != nil {
		t.Errorf("VerifyMultisigAny rejected a valid single signature: %v", err)
	} else {
		t.Log("VerifyMultisigAny(1 valid sig, threshold=3) -> ACCEPTED")
	}

	if err := core.VerifyMultisig(hash, one, ks); err != nil {
		t.Logf("VerifyMultisig(1 valid sig, threshold=3) -> rejected: %v", err)
	}

	for _, bt := range []core.BlockType{
		core.BlockLeaseSettle, core.BlockLeaseForceSettle,
		core.BlockLeaseCancel, core.BlockLeaseAccept, core.BlockReceive,
	} {
		t.Logf("IsSpendingOp(%s) = %v", bt, core.IsSpendingOp(bt))
	}
}
```

## Impact

- **`lease_accept`** \- debits the provider's balance by `LeaseStake(cost)` and legally binds the provider's machine. One signer can commit the account.
- **`lease_cancel`** \- refunds escrow to the consumer. One signer can unwind an active lease.
- **`lease_settle` / `lease_force_settle`** \- move emission to the provider. These additionally require timekeeper attestations, so the practical exposure is lower than for accept/cancel; I am flagging them for completeness, not claiming they are equally exploitable.
- **`receive`** \- `updateDelegation` (`core/ledger.go:2614-2622`) applies `newBlock.Representative` for every block, and `validateAndAddReceive` never inspects that field. Combined with the 1-of-N path this is the consensus-weight hijack described in #6 section 1 item 1\. Also still unpatched.

## Recommendation

1. Add `BlockLeaseAccept`, `BlockLeaseCancel`, `BlockLeaseForceSettle`, `BlockLeaseSettle` and `BlockReceive` to `IsSpendingOp`, as #7 and #110 already propose.
2. Independently, make `VerifyMultisigAny` safe by construction: either enforce `len(valid) >= ks.Threshold` inside it, or delete it and have `verifyBlockCredential` call `VerifyMultisig` unconditionally. Leaving a threshold-ignoring verifier in the package is what allowed this to recur across four block types.
3. Add the primitive-level regression test above, so the next block type added to the enum fails CI rather than shipping.

## Note on a withdrawn finding

While investigating I briefly concluded that `multisig_open` was unreachable because `DeriveMultisigAddress` (`sha256(threshold‖count‖keys)`) can never equal `DeriveAddress` (`sha256("xe/account/v1"‖pubkey)`), which `ValidatePubKeyDeclaration` demands for open blocks. **That conclusion was wrong and I am withdrawing it.** `ValidatePubKeyDeclaration` returns `nil` immediately when `len(b.Signatures) > 0` (`core/crypto.go:120-125`), before the pub\_key branch is ever reached, and `verifyBlockCredential` then validates the signatures against `b.MSKeyset`. I verified with the real `Ledger` that a 2-of-3 `multisig_open` with genuine threshold signatures is admitted and the keyset installed, and that a forged signature is rejected with `multisig: sig from ...: signature verification failed`. No report was filed for it. I mention it only so the team knows it was checked and is not an issue.

## Payout

XE address to be provided on request. I am not claiming a bounty for the duplicate portion; if the team awards anything, the `VerifyMultisigAny` primitive analysis and the unmerged-PR verification are the parts I consider mine.

### Thread

**Joseph Denne**team2026-11-05 22:05 UTCgithub

Thanks. This is the same finding as https://bounty.xe.network/XE-0068, 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, reply with what differs and we will look again.
