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

Reject out-of-range txn version on PSBTv2 path

Public commit record

What the developer wrote

Authored by scgbckbone

68/100 · Adequate
Reject out-of-range txn version on PSBTv2 path

The `bad txn version` check (`txn_version in {0,1,2,3}`) lives in
parse_txn(), which only runs for PSBTv0. On the PSBTv2 path read_psbt()
skips parse_txn(), so PSBT_GLOBAL_TX_VERSION was used unvalidated: a v2
PSBT with nVersion 4 (or a negative value) could be approved and signed,
producing a transaction the network will not relay.

validate() already enforces PoR-specific versions (0 only for BIP-322,
{0,2} for PoR txns) but had no upper bound for ordinary transactions. Add
the matching non-PoR bound (txn_version in {1,2,3}) so both v0 and v2
reject out-of-range versions while the BIP-322 PoR path is unchanged.

Add test_psbt_v2_bad_txn_version (versions 4, -1, 100 rejected on v2).
Verified to fail pre-patch (v2 reaches 'OK TO SEND?') and pass with the
fix; full test_bip322.py suite still passes.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This fix closes a gap where COLDCARD would approve and sign a Bitcoin transaction with an invalid version number if the transaction was packaged in the newer PSBTv2 format. For PSBTv0, such bad versions were already rejected, but the PSBTv2 code path skipped that check. The result could be a signed transaction that the Bitcoin network refuses to relay, potentially trapping funds or breaking wallet workflows. The patch adds the same version-number sanity check to the shared validation routine so both PSBT versions are protected.

Recommended action

Users should upgrade to a firmware release containing this commit. Until then, avoid signing PSBTv2 transactions from untrusted sources and verify that produced transactions use standard nVersion values (1, 2, or 3).

Security signals we found

01

Missing input validation on alternate code path

02

Signed output could be non-relayable / invalid on network

03

Regression test demonstrates pre-patch bypass reached 'OK TO SEND?'

04

Fix aligns validation logic across PSBTv0 and PSBTv2 paths

Risk score

Why this scored 64/100

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