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

Make the MuSig2 psbt_session_id independent of the transaction

Public commit record

What the developer wrote

Authored by Salvatore Ingala

83/100 · Strong
Make the MuSig2 psbt_session_id independent of the transaction

The psbt_session_id used to commit to the transaction hashes, making it
impossible to pre-generate nonces for a future transaction.

Derive the id from the wallet policy alone: the hash of its descriptor
template, and the root of the Merkle tree of its keys.

A client can now execute round 1 whenever it likes -- for example while the
device happens to be connected -- and use the resulting pubnonces for
whichever transaction it later builds. This works as long as its inputs sit
at the same indexes, and the pubnonces are moved to the new PSBT in the
right place and with the right key - which depend on the tweaked aggregate
key, and therefore on the actual UTXOs spent in round 2.

The tradeoff is that at most one round-1 session can be pending per wallet
policy, since a new round 1 replaces the session in storage.

New tests:
- round 1 is executed on a transaction that spends a different UTXO, at a
different (change, address_index), and pays a different output; round 2
for the actual transaction must succeed.
- the same, for a musig() in a tapleaf: round 1 is executed on a transaction
that spends a different UTXO and pays a different output.
- round 1 for another policy with the same keys, executed between round 1
and round 2, must not affect round 2. This simulates a software wallet
that pregenerates nonces before knowing the transaction.
- a second round 1 for the same policy replaces the pending session: round 2
with the pubnonces of the first round 1 must fail.

The documentation in doc/musig.md is updated accordingly.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit changes how the Ledger Bitcoin app identifies an in-progress MuSig2 multi-signature session. Previously, the session ID was tied to the specific transaction, so you could only start the signing process after the transaction was known. Now the session ID depends only on the wallet policy (the spending rules), allowing users to generate public nonces ahead of time for a later transaction. This is a deliberate feature change, not a fix for an active exploit. The trade-off is that only one pending session is allowed per wallet policy, and starting a new session overwrites the old one.

Recommended action

Review the security implications of allowing transaction-independent MuSig2 pubnonces, particularly the risk of a user generating nonces for one planned transaction and then inadvertently signing a different transaction. Ensure wallet software correctly manages session state and pubnonce placement. No urgent patch is indicated from the diff alone.

Security signals we found

01

Change in cryptographic session binding from (wallet policy + transaction) to wallet policy only

02

Removal of transaction hash commitment from MuSig2 session identifier

03

Addition of assertions and comments explaining the security trade-off (one session per wallet policy, session replacement)

04

New tests verifying cross-transaction nonce reuse and session replacement behavior

05

No evidence of memory corruption, buffer overflow, or secret leakage in the diff

Risk score

Why this scored 26/100

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