XE-10329 · Bounty
Binary Codec Invariant Violation: UnmarshalBlock drops PoWNonce on BlockMultisigOpen and BlockMultisigUpdate due to static tailOffset calculation
Closed · duplicate
—
web
filed 2026-11-12 12:05 UTC
by xe:e4cd6974
Report
Vulnerability Summary
In core/encoding.go:377-531, unmarshalBlock decodes binary-encoded blocks from network streams and storage. For BlockMultisigOpen and BlockMultisigUpdate:
case typeByteMultisigOpen:
blockType = BlockMultisigOpen
minLen = fixedHeaderSize + 8 + representativeSize
case typeByteMultisigUpdate:
blockType = BlockMultisigUpdate
minLen = fixedHeaderSize + 8 + representativeSize
...
case BlockMultisigOpen, BlockMultisigUpdate:
ks, ksLen, err := unmarshalKeysetCanonical(data[90:])
if err != nil {
return nil, fmt.Errorf("UnmarshalBlock: keyset: %w", err)
}
b.MSKeyset = ks
repOffset = 90 + ksLen
if len(data) < repOffset+representativeSize {
return nil, fmt.Errorf("UnmarshalBlock: data too short for %s after keyset", blockType)
}
...
tailOffset := minLen
...
if len(data) == tailOffset+8 {
b.PoWNonce = binary.LittleEndian.Uint64(data[tailOffset:])
}
Critical codec calculation bug:
- Dynamic Keyset Length Ignored: When a keyset has $K$ keys, its encoded length is
ksLen = 8 + 32*K. The representative field is placed atrepOffset = 90 + ksLen, and the 8-bytePoWNonceis placed atrepOffset + 32. - Static
tailOffset: Line 499 setstailOffset := minLen, whereminLenwas statically computed with an assumed keyset size of 8 bytes (fixedHeaderSize + 8 + representativeSize = 130). - PoW Nonce Loss & Misalignment:
- For any valid keyset containing at least one key ($K \ge 1$),
len(data)equals130 + 32*K. Since130 + 32*K != 138, the checkif len(data) == tailOffset+8evaluates tofalse.b.PoWNonceis silently dropped and set to0. - If a keyset had 0 keys ($K=0$),
tailOffsetequals 130, which points to theRepresentativefield, mistakenly interpreting the representative public key bytes as the proof-of-work nonce.
- For any valid keyset containing at least one key ($K \ge 1$),
Impact & Severity
- Consensus PoW Verification Failure: When binary blocks are transmitted over P2P sync and decoded via
UnmarshalBlock, the resulting block object hasb.PoWNonce == 0. Subsequent consensus validation inValidatePoWrejects the block withfailed PoW validation. - Roundtrip Serialization Invariant Broken:
UnmarshalBlock(MarshalBlockCanonical(b))fails roundtrip equality, corrupting multisig state during peer synchronization.
Proposed Remediation
In core/encoding.go, dynamically update tailOffset after unmarshaling the keyset:
case BlockMultisigOpen, BlockMultisigUpdate:
ks, ksLen, err := unmarshalKeysetCanonical(data[90:])
if err != nil {
return nil, fmt.Errorf("UnmarshalBlock: keyset: %w", err)
}
b.MSKeyset = ks
repOffset = 90 + ksLen
tailOffset = repOffset + representativeSize
Thread
Joseph Denneteam2026-11-20 00:33 UTCdesk
Thanks. This is the same finding as https://bounty.xe.network/XE-0083, 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-10329 and says what differs; it is read like any other.