Import PSBT accepts structurally invalid transactions into review and signing #1070

Open
opened 2026-11-05 14:14:14 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-05 14:14:14 +00:00 (Migrated from github.com)

Import PSBT does not reject some invalid transaction structures before building the review. In the duplicate-input case, the flow also signs and commits an invalid wallet transaction, reports completion, and leaves the original coin unavailable until the transaction is abandoned.

A separate malformed-output case produces incorrect review totals. Both belong to the checks needed before an imported transaction becomes a payment review.

Duplicate-input reproduction

  1. Create an unsigned PSBT containing two inputs that reference the same spendable wallet outpoint. Supply the required UTXO information for both inputs and keep the outputs below the value of the single original coin.
  2. Import it through Send → Options → Import PSBT.
  3. Observe that review displays both copies of the input, shows Ready, and enables Send transaction.
  4. Click Send.
  5. Inspect the wallet transaction and node acceptance result.

QML reports completion, but the node rejects the transaction with bad-txns-inputs-duplicate. The wallet nevertheless retains the invalid send record, and the original outpoint is no longer available through listunspent.

Calling abandontransaction on that record restores the coin’s availability. The transaction was never accepted into the mempool; no permanent fund loss was demonstrated.

Malformed-output reproduction

Import PSBTs with these raw output amounts, in satoshis:

  • [INT64_MAX, INT64_MAX, 4]: the review reports an aggregate of 2 sats.
  • [INT64_MIN, INT64_MAX, 2]: the review accepts the negative and out-of-range outputs and reports 1 sat.

The individual recipient rows retain the malformed values. In these fixtures, missing input information makes the fee unknown, so Send and Broadcast remain disabled.

Expected behavior and responsibility

Reject duplicate inputs, invalid output amounts, and invalid aggregate totals before constructing an actionable review. Duplicate-input transactions must not reach signing or wallet commit.

This crosses the QML/Core wallet boundary: the shared PSBT analysis and wallet signing/commit path allow the duplicate-input transaction to progress, while QML uses those results to approve and complete the flow. QML’s wallet and recipient models also aggregate malformed output amounts without the necessary range and overflow checks. Core’s node validation correctly rejects the invalid transaction.

This complements #1008: correcting the completion message alone would still leave the invalid wallet record and unavailable coin.

Reproduced on qt6 at d567e3eb2497, macOS arm64, Qt 6.9.0, using disposable regtest fixtures.

Import PSBT does not reject some invalid transaction structures before building the review. In the duplicate-input case, the flow also signs and commits an invalid wallet transaction, reports completion, and leaves the original coin unavailable until the transaction is abandoned. A separate malformed-output case produces incorrect review totals. Both belong to the checks needed before an imported transaction becomes a payment review. **Duplicate-input reproduction** 1. Create an unsigned PSBT containing two inputs that reference the same spendable wallet outpoint. Supply the required UTXO information for both inputs and keep the outputs below the value of the single original coin. 2. Import it through **Send → Options → Import PSBT**. 3. Observe that review displays both copies of the input, shows Ready, and enables **Send transaction**. 4. Click Send. 5. Inspect the wallet transaction and node acceptance result. QML reports completion, but the node rejects the transaction with `bad-txns-inputs-duplicate`. The wallet nevertheless retains the invalid send record, and the original outpoint is no longer available through `listunspent`. Calling `abandontransaction` on that record restores the coin’s availability. The transaction was never accepted into the mempool; no permanent fund loss was demonstrated. **Malformed-output reproduction** Import PSBTs with these raw output amounts, in satoshis: - `[INT64_MAX, INT64_MAX, 4]`: the review reports an aggregate of **2 sats**. - `[INT64_MIN, INT64_MAX, 2]`: the review accepts the negative and out-of-range outputs and reports **1 sat**. The individual recipient rows retain the malformed values. In these fixtures, missing input information makes the fee unknown, so Send and Broadcast remain disabled. **Expected behavior and responsibility** Reject duplicate inputs, invalid output amounts, and invalid aggregate totals before constructing an actionable review. Duplicate-input transactions must not reach signing or wallet commit. This crosses the QML/Core wallet boundary: the shared PSBT analysis and wallet signing/commit path allow the duplicate-input transaction to progress, while QML uses those results to approve and complete the flow. QML’s wallet and recipient models also aggregate malformed output amounts without the necessary range and overflow checks. Core’s node validation correctly rejects the invalid transaction. This complements [#1008](https://github.com/bitcoin-core/gui-qml/issues/1008): correcting the completion message alone would still leave the invalid wallet record and unavailable coin. Reproduced on `qt6` at `d567e3eb2497`, macOS arm64, Qt 6.9.0, using disposable regtest fixtures.
Sign in to join this conversation.
No description provided.