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

psbt: reject nil taproot pointer fields

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

68/100 · Adequate
psbt: reject nil taproot pointer fields

In this commit, we extend taproot PSBT serialization and finalization to reject nil script spend signatures, leaf scripts, and BIP32 derivations before any sort or dereference. We return wrapped ErrInvalidPsbtFormat errors so callers can identify malformed packet state without parsing strings.

We also make FindLeafScript reject nil inputs and leaf entries. This keeps both the direct finalizer and MaybeFinalize paths from panicking on malformed in-memory packets.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a class of crash bugs in btcd's PSBT (Partially Signed Bitcoin Transaction) handling for Taproot transactions. Previously, if certain Taproot-related lists contained a nil (empty) entry, the code would panic when trying to sort, read, or finalize the transaction. The patch now rejects these malformed entries early with a proper error instead of crashing the program. It is a defensive hardening fix rather than a direct theft-of-funds vulnerability, but a crash in a wallet or node could still be disruptive.

Recommended action

Treat as a defensive security hardening fix. Upgrade to a release containing this commit if your application accepts externally supplied or untrusted PSBTs, especially for Taproot inputs/outputs. Review any custom PSBT construction code to ensure it does not insert nil entries into Taproot slice fields. No immediate incident response is indicated unless crashes have already been observed.

Security signals we found

01

nil-pointer dereference / panic prevention in Taproot PSBT finalizer

02

nil-pointer dereference / panic prevention in PSBT serialization

03

input validation added before sort.Slice and pointer dereference

04

new test coverage for malformed in-memory PSBT packets

05

error wrapping with ErrInvalidPsbtFormat for programmatic detection

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/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.