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

wallet.check_sighash: don't assume tx.add_info_from_wallet alrdy ran

Public commit record

What the developer wrote

Authored by SomberNight

85/100 · Strong
wallet.check_sighash: don't assume tx.add_info_from_wallet alrdy ran

Sighash warnings/errors might in theory not be triggered for
inputs owned by the wallet but which are beyond the gap limit.
tx.add_info_from_wallet(wallet) side-effects the wallet state
so that wallet.is_mine() learns derivation paths for beyond-gap-limit addresses.

In practice both GUIs currently call tx.add_info_from_wallet before
check_sighash runs, so this was not exploitable.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a defensive check in the Electrum Bitcoin wallet. Before signing a transaction, Electrum checks whether the transaction uses unusual 'sighash' flags that could allow someone else to move coins unexpectedly. The bug was that this safety check could be skipped for wallet addresses that were beyond the user's configured gap limit, because the wallet had not yet learned those addresses belonged to it. The fix makes the check self-contained by first asking the transaction to teach the wallet about any relevant addresses, using a copy so the original transaction is not changed. The commit message says the current graphical interfaces already performed this step, so the bug was not exploitable in practice through normal use.

Recommended action

Treat as a defense-in-depth hardening patch. Merge and include in the next release. Users running current releases are likely not at immediate risk because the GUI code paths already populate wallet info before signing, but downstream callers or future refactors could reintroduce the gap. No urgent advisory is required unless a concrete exploit path bypassing the GUI is demonstrated.

Security signals we found

01

Sighash sanity check could be bypassed for beyond-gap-limit wallet inputs

02

Fix adds defensive deep-copy and wallet-info population inside check_sighash

03

Regression test demonstrates dangerous sighash is now caught even with gap_limit=2

04

Commit message states current GUIs already call add_info_from_wallet before check_sighash, limiting practical exploitability

Risk score

Why this scored 42/100

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