1 major finding · 2 minor findings · 1 suggestion
Earlier concerns neither republished nor resolved: 1 minor finding · 3 suggestions. See the Run archive for their assessments.
Findings
[major] · Already-finalized inputs cause external-signer requests to fail
walletprocesspsbt can return EXTERNAL_SIGNER_FAILED when an input was finalized before the signer call or finalized by an earlier script manager.
Location: src/external_signer.cpp:170 (head).
Details and suggested fix
The response check rejects any PSBT containing a finalized input, even when that input was already finalized in the request. Core sends finalized inputs to the signer, and CWallet::FillPSBT treats them as complete and skips them. A signer that returns the request with its signatures can therefore be rejected. There is also a second-call case: with the default finalize=true and an unsigned foreign input, one script manager can sign and finalize the wallet's inputs before the next manager calls the signer. For Taproot inputs, the retained derivation paths still match the signer fingerprint, so the second request includes those newly finalized inputs and is rejected. To avoid both failures, reject only inputs the signer newly finalized, such as by checking PSBTInputSigned in the response but not in the request. Update the documentation to allow already-finalized inputs to be returned unchanged, and add a walletprocesspsbt test with a pre-finalized input. The in-tree mock returns finalized inputs unchanged; HWI's handling could not be checked from this repository.
[minor] · PSBTv2 responses can change an omitted input sequence
A PSBTv2 request that omits PSBT_IN_SEQUENCE can be merged with a signer response that changes the effective sequence; no in-tree producer for this request was identified, so production impact is unconfirmed.
Location: src/external_signer.cpp:181 (head).
Details and suggested fix
In PSBTv2, PSBT_IN_SEQUENCE is optional, and a missing value produces SEQUENCE_FINAL in the unsigned transaction. The transaction identity check zeroes every PSBTv2 sequence before hashing, so it does not detect a sequence change. During merge, the signer's sequence fills a field omitted from the request. The signer can therefore set a sequence such as 0xfffffffd or a BIP68 relative locktime, which may be used to produce a complete transaction with a sequence the caller did not specify. Merge into a temporary copy, require its unsigned transaction to equal the original, and assign it only if they match. Extend the change_sequence test with a request that omits the sequence. Core-created PSBTs always set it; this behavior requires a PSBTv2 created by another tool and passed to walletprocesspsbt, and no such in-tree producer was identified.
[minor] · A request-only MuSig2 sighash can bypass the unsafe-sighash check
If a MuSig2 signer omits a request-declared SIGHASH_NONE or SIGHASH_SINGLE from its response, the check can miss it; whether a supported external signer triggers this is unconfirmed.
Location: src/external_signer.cpp:175 (head).
Details and suggested fix
FindUnsafeSighashType checks the signer's response, not the merged PSBT, and does not inspect MuSig2 partial signatures. Those signatures do not carry a sighash byte, so their effective sighash comes from the input's sighash_type. If a request declares SIGHASH_NONE or SIGHASH_SINGLE and the signer omits that field from its response, the check passes; merge restores the request's declaration, and finalization uses it to create the aggregate signature. If the other participants' partial signatures are present, the resulting valid signature does not commit to all outputs. A signer that copies the declaration back is rejected, so this depends on whether the signer strips fields. Merge into a temporary copy, run FindUnsafeSighashType on the merged PSBT, and commit it only if the check passes. No in-tree external-signer flow producing MuSig2 partial signatures was identified, so production impact is unconfirmed.
Optional improvements
[suggestion] · Sighash tests do not cover Taproot script-path signatures
The tests would not catch removal of the m_tap_script_sigs check in FindUnsafeSighashType.
Location: test/functional/wallet_signer.py:275 (head).
Details and suggested fix
The bech32m cases spend outputs from key-only tr(...) descriptors, so the mock produces PSBT_IN_TAP_KEY_SIG, not script-path signatures. The separate m_tap_script_sigs branch is therefore not exercised. Add a script-path-only Taproot spend whose leaf key the mock wallet can sign, then run the hidden NONE and SINGLE rejection cases and the DEFAULT acceptance case against it.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Document the accepted sighash types
- [suggestion]: Add release notes for the signer compatibility change
- [suggestion]: Remove unused
<map>and<set>includes - [minor]: Do not retain unverified signer signatures in the caller's PSBT