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

psbt: Refuse v2 global tx under loose parsing

Public commit record

What the developer wrote

Authored by kkdao

73/100 · Adequate
psbt: Refuse v2 global tx under loose parsing

wally_psbt_from_bytes() with WALLY_PSBT_PARSE_FLAG_LOOSE accepted a v2
PSBT carrying PSBT_GLOBAL_UNSIGNED_TX if the tx key came before the
version key. psbt_set_global_tx() allocated the input and output arrays
for the tx, then the v2 path overwrote those pointers with new arrays,
leaking the old ones.

Refuse such a PSBT instead of freeing the arrays. A v2 PSBT with a tx
fails psbt_is_valid(), so it could not even be serialized, and the
reverse key order is already refused by psbt_set_global_tx(). The
signature-only PSBTs that loose parsing exists for never have a tx in
v2.
✓ 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 change fixes a memory leak in the library's handling of a specific kind of invalid Bitcoin transaction file (PSBT v2 with an unexpected global transaction). Previously, parsing such a file under loose parsing could allocate memory for inputs/outputs, then overwrite those pointers, leaking the memory. The patch now rejects these invalid files outright. It does not appear to be a security-critical remote code execution or theft bug, but it is a correctness and denial-of-service hardening fix.

Recommended action

Apply the patch. It is a low-risk hardening fix that prevents memory leaks and rejects invalid PSBT v2 inputs. No immediate incident response is warranted unless the application is exposed to untrusted PSBT parsing and memory exhaustion is a concern, in which case updating and monitoring for malformed v2 PSBTs is prudent.

Security signals we found

01

Memory leak on parsing malformed PSBT v2 with global tx

02

Invalid PSBT v2 accepted under loose parsing flag

03

Pointer overwrite after allocation in psbt_set_global_tx / v2 path

04

New explicit validation: v2 PSBT must not carry global unsigned tx

Risk score

Why this scored 45/100

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