mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
external signer: verify PSBT is reliable after signing it #35358
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!35358
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-04-external-signer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seeking Concept ACK
A compromised or "rogue" external signer could return a PSBT with silently altered outputs or use unsafe sighash types that do not commit to all outputs (perhaps unlikely, but a buggy signer could also change it). This PR adds a post-signing validation step in
External::SignTransactionthat compares the signed PSBT returned by the external signer against the original one before accepting it. Without these checks, it is not super friendly (e.g. using RPC) to manually verify the same.Note: the added tests were partially vibe-coded.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
LLM Linter (✨ experimental)
Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):walletcreatefundedpsbt([], {dest: 0.5}, 0, {...}, True)intest/functional/wallet_signer.py2026-05-22 13:11:37
Should
SIGHASH_ALL | SIGHASH_ANYONECANPAYreally be considered safe here?The PR protects outputs, and
ANYONECANPAY|ALLdoes commit to alloutputs. But
ANYONECANPAYalso means the signed input can be includedin a larger transaction with additional inputs that the wallet did not
authorize. If the expected sighash is
SIGHASH_ALL(orSIGHASH_DEFAULTfor taproot), a rogue signer silently downgrading to
ANYONECANPAY|ALLwould pass this check while producing a signature with strictly weaker
commitment.
Is allowing
ANYONECANPAYan intentional design choice here, or shouldthe check require the returned sighash to match the PSBT's per-input
sighash field when present, and fall back to the default policy otherwise?
Yes.
It is not a problem for us if someone else adds more inputs. We only care that the inputs we want spend and the outputs we want to send to are all in the transaction. If someone else adds more inputs, the inputs we want to spend are still there, and the outputs we want to create are still committed to. There is no effect to the wallet, hence it is safe.
Concept OK I guess
I think we generally assume an external signer to be more trusted/secure, so we don't really do checks on their output. An external signer can always leak private keys or steal the user's coins and there isn't much we can do about it.
I absorbed this into #36114, which revamps the external signer mock in a way that makes this stuff easier to test.
Base:
cf80493e2367786ce9946c522eb8313a52c90557Head:
e5ca77ed5049ec273bb11a441ca86d9389507f66No verified findings are available from this partial review.
Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial review had incomplete evidence. The adversarial_glm review had incomplete evidence. Verifier output failed validation; no findings were published.
Full review report
@brunoerg do you want to close this and continue in #36114? Or is the plan to work on this first?
Yes, I can close this and focus in #36114. I'm going to review that.