Bounty
XE-1134 · Bounty

[HIGH] net: Gossip.Subscribe requires len(b.Signature) == 128 and silently drops 100% of multisig blocks across the network

Closed · duplicate —claimed High xe#291 filed 2026-11-07 16:35 UTC by pa-khan

Report

Summary

Every multisig block in XE (multisig_open, multisig_update, and any send, receive, lease, lease_accept, lease_settle, lease_cancel, lease_force_settle, lease_renew, burn, or mint signed by a multisig account) carries an empty single-key Signature field (b.Signature == "") and stores its credentials in b.Signatures []core.BlockSignature.

While the GossipSub topic validator blockValidator (net/gossip_validate.go:77) was updated to accept multisig blocks (if len(b.Signature) != 128 && len(b.Signatures) == 0), the subscriber loop Gossip.Subscribe (net/gossip.go:150) still enforces len(b.Signature) != 128:

b := bm.Block
if len(b.Hash) != 64 || len(b.Signature) != 128 || len(b.Account) != 64 {
    continue
}

Because len(b.Signature) == 0 on every valid multisig block (and core.ValidatePubKeyDeclaration / core.VerifyBlock treat len(b.Signatures) > 0 as the multisig credential path), Gossip.Subscribe silently drops 100% of multisig blocks on every subscribing node in the network immediately after blockValidator accepts and forwards them across the GossipSub mesh.

In addition, blockValidator (net/gossip_validate.go:77) only checks len(b.Signature) != 128 && len(b.Signatures) == 0 without enforcing mutual exclusion between b.Signature and b.Signatures, without bounding len(b.Signatures) to the 256-key canonical keyset cap (unmarshalKeysetCanonical in core/encoding.go:567), and without validating that each core.BlockSignature entry has a 64-character hex PublicKey, a 128-character hex Sig, and unique signers.

Affected Code

  • net/gossip.go (Gossip.Subscribe, lines 149–152):
    b := bm.Block
    if len(b.Hash) != 64 || len(b.Signature) != 128 || len(b.Account) != 64 {
        continue
    }
    
  • net/gossip_validate.go (blockValidator, lines 73–79):
    if !isHex64(b.Hash) || !isHex64(b.Account) {
        return pubsub.ValidationReject
    }
    
    if len(b.Signature) != 128 && len(b.Signatures) == 0 {
        return pubsub.ValidationReject
    }
    
  • node/node.go (Node.handleIncoming, lines 570, 705–739): n.handleIncoming(gossip.Subscribe(ctx)) is the sole entry point for live gossip block ingestion, provider lease auto-acceptance (n.autoAcceptLease(b) at line 721), and consumer VM credential scrubbing on lease_settle (lines 729–737).

Root Cause & Impact

  1. 100% Gossip Drop of All Multisig Blocks:

    • When a node accepts a multisig block via SubmitBlock (node/node.go:1282) and calls n.Gossip.Publish(n.ctx, b), GossipSub's blockValidator returns pubsub.ValidationAccept, but every peer's Gossip.Subscribe loop hits len(b.Signature) != 128 (0 != 128) and executes continue.
    • No peer or representative ever receives any multisig block over the xe/blocks gossip topic.
  2. Provider autoAcceptLease & VM Provisioning Never Trigger for Multisig Consumers (Escrow Lockup):

    • In node/node.go:721, provider auto-acceptance (n.autoAcceptLease(b)) is triggered exclusively inside handleIncoming(gossip.Subscribe(ctx)) and is never invoked when blocks arrive later via /xe/sync/1.0.0 (Ledger.AddSyncedBlock).
    • Consequently, any lease block submitted by a multisig consumer account is dropped by Gossip.Subscribe on the provider node, so the provider never auto-accepts the lease or provisions the VM, leaving the multisig consumer's XUSD locked in escrow until expiration.
    • Similarly, a lease_settle block from a multisig provider never reaches handleIncoming (node/node.go:729) on the consumer node to mark the VM "stopped" and scrub cached credentials.
  3. Delayed/Suppressed Fork Detection on Conflicting Multisig Blocks:

    • If two conflicting multisig blocks at the same (Account, Previous) are submitted to different nodes, neither block is delivered over xe/blocks gossip. During /xe/sync/1.0.0, findMissingBlocksPaginated (net/sync.go:714) treats the peer's divergent frontier as unrecognized rather than staging a conflict until multiple consecutive sync rejections elapse.
  4. Unvalidated b.Signatures Entries & Hybrid Signature+Signatures Bypass in blockValidator:

    • Because b.Signature and b.Signatures are excluded from core.HashBlock(b) (and PoW), blockValidator accepts hybrid blocks carrying both b.Signature and b.Signatures, blocks with >256 multisig signature entries, duplicate signers, or entries with short/non-hex PublicKey (len(sig.PublicKey) < 64, which triggers an unbounds-checked pk[:12] slice panic in core.VerifyMultisig at core/multisig.go:94,99,103).

Reproduction (Failing Pre-Fix Test)

Run go test -race -v ./net -run 'TestGossipSubscribeDeliversMultisigBlocks|TestBlockValidatorMultisigAndMalformedSignatures':

=== RUN   TestGossipSubscribeDeliversMultisigBlocks
    gossip_multisig_test.go:131: Gossip.Subscribe silently dropped valid multisig block c0a006a9080f (Signature="", len(Signatures)=2)
--- FAIL: TestGossipSubscribeDeliversMultisigBlocks (2.10s)
=== RUN   TestBlockValidatorMultisigAndMalformedSignatures
    gossip_multisig_test.go:158: hybrid Signature+Signatures block: got 0, want ValidationReject
--- FAIL: TestBlockValidatorMultisigAndMalformedSignatures (0.00s)
FAIL
FAIL	github.com/xeprotocol/xe/net	2.129s

Proposed Fix

  1. Introduce hasValidBlockSignatures(b *core.Block) bool in net/gossip_validate.go that enforces:
    • Mutual exclusion between single-key b.Signature != "" and multisig len(b.Signatures) > 0 (hasSingle != hasMulti).
    • isHex128(b.Signature) when b.Signature != "".
    • 1 <= len(b.Signatures) <= maxMultisigSignatures (256), isHex64(sig.PublicKey), isHex128(sig.Sig), and case-insensitive uniqueness of sig.PublicKey across b.Signatures.
  2. Use !isHex64(b.Hash) || !isHex64(b.Account) || !hasValidBlockSignatures(b) in both blockValidator (net/gossip_validate.go) and Gossip.Subscribe (net/gossip.go).

Payout / Reward Address (Base / EVM / XE): 0x45Ecf534fD00bb3179D34E6a3FDdE084cBfBc9Fb

Thread

XE deskteam2026-11-14 22:53 UTCgithub

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-1134 and says what differs; it is read like any other.