AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 60 Bitcoin

psbt: fix finalizing large P2SH and bare multisig inputs

Public commit record

What the developer wrote

Authored by odudex

78/100 · Adequate
psbt: fix finalizing large P2SH and bare multisig inputs

Legacy multisig scriptSigs were built in a WALLY_SCRIPTSIG_MAX_LEN
(520 byte) buffer, which is the limit for a single push, not for a
scriptSig. P2SH inputs needing more (e.g. 5-of-5, 4-of-7, 1-of-13)
were silently left unfinalized. Allocate the buffer instead.

Bare multisig scriptSigs also pushed the multisig script after the
signatures, which CHECKMULTISIG then took as a signature, making the
spend invalid. Only push the script for P2SH.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes two bugs in how the library finalizes old-style multi-signature Bitcoin transactions. First, large multisig setups (like 5-of-5 or 4-of-7) were silently left unfinished because the buffer used was too small. Second, for bare multisig transactions, the final script incorrectly included the whole redeem script as if it were another signature, making the spend invalid. The patch allocates a correctly sized buffer and only appends the redeem script for P2SH inputs.

Recommended action

Review and merge the patch, then run the new regression tests. Users relying on legacy multisig PSBT finalization should upgrade, especially those using large P2SH multisig or bare multisig configurations.

Security signals we found

01

Buffer size mismatch causing silent failure to finalize large multisig inputs

02

Incorrect scriptSig construction for bare multisig producing invalid spends

03

Heap allocation introduced to replace undersized stack buffer

04

New regression tests for large P2SH and bare multisig finalization

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 8/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.