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

Merge bitcoin/bitcoin#35984: sign: skip signing SIGHASH_SINGLE inputs with no corresponding output

Public commit record

What the developer wrote

Authored by Ava Chow

86/100 · Strong
Merge bitcoin/bitcoin#35984: sign: skip signing SIGHASH_SINGLE inputs with no corresponding output

8df006f233839736b6d7b856bcf8673526c7acef wallet: skip signing SIGHASH_SINGLE inputs with no corresponding output (furszy)

Pull request description:

`SIGHASH_SINGLE` only commits to the output at the input's index. If the output at such
position doesn't exist, it commits to no output at all (legacy uses a fixed sighash of 1, segwit
v0 zeroes `hashOutputs`), which means the signature stays valid even when outputs are
swapped, which is a footgun that lets funds be redirected without the owner's consent.

`SignTransaction()` already skipped these inputs, but `SignPSBTInput()` did not, so
`walletprocesspsbt` signed them. This moves the check into the `CreateSig` so both
paths, and any future one, skip producing the detached signature.

Note: if there is a valid use for the segwit v0 case, I would rather re-allow it through
an explicit opt-in arg than by default, so it is always a deliberate choice.

Fixes #35977

ACKs for top commit:
thomasbuilds:
ACK 8df006f
achow101:
ACK 8df006f233839736b6d7b856bcf8673526c7acef

Tree-SHA512: ac1c9659910eae889475c65b8dde68e711c4d85d0d520af06411728591e573bf027b41a9ac6dd0f6e93de425841ac6c7d9e6c9f07936b9d8ae390941fbe6f1f1
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This Bitcoin Core update fixes a wallet-signing quirk. When a user chose the SIGHASH_SINGLE signature mode, an input that had no matching output index would sign essentially nothing meaningful. That signature could then stay valid even if someone later changed where the money goes, creating a risk of funds being redirected without the original owner's consent. The fix makes the signer refuse to create such signatures in the first place, closing the gap for both normal transaction signing and PSBT signing.

Recommended action

Treat as a security-hardening fix and include in release notes. Users relying on SIGHASH_SINGLE with fewer outputs than inputs should be aware signing will now fail for unmatched inputs; if a legitimate segwit-v0 use case exists, consider the explicit opt-in mechanism the author mentioned rather than reverting the default behavior.

Security signals we found

01

Funds-redirection footgun from SIGHASH_SINGLE signatures with no committed output

02

Inconsistent guard between SignTransaction and SignPSBTInput paths

03

Fix centralizes the guard in the low-level signature creator to cover future signing paths

04

Functional test added verifying walletprocesspsbt refuses to finalize the unmatched input

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.