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

psbt: Refuse upgrading a v0 PSBT with no tx

Public commit record

What the developer wrote

Authored by kkdao

68/100 · Adequate
psbt: Refuse upgrading a v0 PSBT with no tx

wally_psbt_set_version() upgrading a v0 PSBT to v2 read the version,
locktime, inputs and outputs from psbt->tx without checking it exists.
A v0 PSBT with no global tx is valid: wally_psbt_init_alloc() makes
one, and loose parsing accepts one, so set_version() on either
dereferenced NULL.

Refuse the upgrade with WALLY_EINVAL, as psbt_build_tx() and the other
v0 paths already do when there is no tx.
✓ 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 crash bug in libwally-core, a Bitcoin/Elements cryptography library. When a user tried to upgrade an older-style PSBT (Partially Signed Bitcoin Transaction) to version 2, the code would follow a pointer to transaction data without first checking that the data existed. If the PSBT had no transaction attached, that pointer was NULL, causing the program to crash (NULL pointer dereference). The fix simply refuses the upgrade with an error when no transaction is present, matching how other parts of the code already handle the same situation.

Recommended action

Treat as a low-to-moderate reliability/defensive fix. Review callers of wally_psbt_set_version() to ensure they handle WALLY_EINVAL gracefully, and confirm no other v0-to-v2 upgrade paths dereference psbt->tx without a guard. Backport to maintained branches if crash exposure is reachable from untrusted PSBT input.

Security signals we found

01

NULL pointer dereference in transaction-version upgrade path

02

Missing input validation on internal object state before pointer dereference

03

Consistency fix aligning with existing psbt_build_tx() and v0 error handling

04

Regression test added for malformed/v0-no-tx upgrade attempt

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.