<div dir="ltr"><div>Hi Craig,<br>Comments inline.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 9, 2021 at 1:17 AM Craig Raw <<a href="mailto:craigraw@gmail.com">craigraw@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Hugo,<div><br></div><div>Thanks for raising this again - I'll note there has already been much discussion on this topic. With respect to your "two layers of protection":</div><div><br></div><div>> The Coordinator shares the TOKEN with all participating Signers over a secure channel.</div><div><br></div><div>What secure channel do you propose? Currently, with the default of a software wallet coordinator talking to hardware wallets, we have USB, file (microSD), and QR as communication channels. It's unclear to me why the token and encryption process is necessary - in fact it's easier to verify what is going on using clear text, and the majority of setups will be locally done with the reasonable assumption of a secure environment. When the setup is remote, it's simpler to just transmit the key information over the secure channel which presumably already has encryption. </div><div><br></div></div></blockquote><div><br></div><div>In short, a shared secret (the TOKEN) is needed because without it you cannot guarantee that the devices you are connecting to are legitimate members of the multisig wallet. Yes, the connection between the coordinator and each device could be secure - but a malicious actor can establish a secure channel just as well as a good one. You are correct that this is less of an issue for local setups, but this is especially important for distributed multisig - where you cannot physically see what's on the other side.<br><br>I would love to remove the shared secret/encryption aspect out of the proposal, but so far I haven't found any way around this issue, aside from establishing a shared secret prior to setting up the wallet...<br><br>I also realized that supporting this could be a big ask for vendors, so I've made this part of the proposal optional.<br><br>Another note here is that right after I posted the proposal (classic...), I also realized there could be another optimization: the secure session established by the shared secret can remain open indefinitely on the device side - until a different TOKEN is entered. That way the user needs to enter the TOKEN only once, saving us one interaction.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>> The second one is through the descriptor checksum and visual inspection of the descriptor itself.</div><div><br></div><div>This is a reasonable suggestion, although it's worth noting that support for storing multisig setups on hardware wallets varies. Coldcard supports this through importing of a proprietary .txt format file (which has been adopted by a number of other vendors). Trezor and Ledger (AFAIK) do not however store multisig setups, which could make this step confusing. With that said, the use of an output descriptor is certainly a more standardised approach, albeit one without the wallet name included. By the use of the singular, I assume you mean a descriptor without the /0/* or /1/* suffix (which I think is a good idea).</div><div><br></div></div></blockquote><div><br>I'm aware that Trezor and Ledger currently cannot support this. But IMHO lack of support on some devices shouldn't prevent us from setting a good standard here. Cosigner registration on the device is crucial, as you don't have to rely on everything being included in the PSBT (which also adds mental overhead as the user has to verify each and every transaction).<br><br>Yes, descriptor without the /0/* and /1/* - Thanks for clarifying. Will update the proposal.<br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>WRT to QR codes, using the BCR UR2.0 standard you linked to is IMO the right approach. I'll link directly to the two BCR UR2.0 formats here which are relevant:</div><div><br></div><div>1. For sharing the sharing the BIP44 account information from the signers to the coordinator, the crypto-account format: [<a href="https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-015-account.md" target="_blank">https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-015-account.md</a>]</div><div>2. For sharing the output descriptor from the coordinator to the signers, the crypto-output format: [<a href="https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-010-output-desc.md" target="_blank">https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-010-output-desc.md</a>]</div><div><br></div></div></blockquote><div><br>Thanks, will update!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Craig</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 9, 2021 at 9:53 AM Hugo Nguyen via bitcoin-dev <<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" target="_blank">bitcoin-dev@lists.linuxfoundation.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<br>I would like to propose a new BIP for Secure Multisig Setup.<br>This proposal has taken inputs from folks at Coldcard, Shift Crypto and Cobo -- listed below as co-authors.<br><br>This was inspired by my own experience working with hardware wallets on the market, as well as existing research into the challenges of multisig.<br><br>Cheers,<br>Hugo<br><div><br></div><div><pre><br>  BIP: To be determined<br>  Layer: Applications<br>  Title: Bitcoin Secure Multisig Setup (BSMS)<br>  Author: Hugo Nguyen <<a href="mailto:hugo@nunchuk.io" target="_blank">hugo@nunchuk.io</a>>, Peter Gray <<a href="mailto:peter@coinkite.com" target="_blank">peter@coinkite.com</a>>, Marko Bencun <<a href="mailto:marko@shiftcrypto.ch" target="_blank">marko@shiftcrypto.ch</a>>, Aaron Chen <<a href="mailto:aarondongchen@gmail.com" target="_blank">aarondongchen@gmail.com</a>>, Rodolfo Novak <<a href="mailto:rodolfo@coinkite.com" target="_blank">rodolfo@coinkite.com</a>><br>  Comments-Summary: No comments yet.<br>  Comments-URI:<br>  Status: Proposed<br>  Type: Standards Track<br>  Created: 2020-11-10<br>  License: BSD-2-Clause<br></pre><br><br>==Introduction==<br><br>===Abstract===<br><br>This document proposes a mechanism to set up multisig wallets securely. <br><br>===Copyright===<br><br>This BIP is licensed under the 2-clause BSD license.<br><br>===Motivation===<br><br>The Bitcoin multisig experience has been greatly streamlined under [<a href="https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki" target="_blank">https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki</a> BIP-0174 (Partially Signed Bitcoin Transaction)]. However, what is still missing is a standardized process for setting up multisig wallets securely across different vendors.<br><br>There are a number of concerns when it comes to setting up a multisig wallet:<br><br># Whether the multisig configuration, such as Signer membership, script type, derivation paths and number of signatures required, is correct and not tampered with.<br># Whether Signer persists the multisig configuration in their respective storage, and under what format.<br># Whether Signer's storage is tamper-proof.<br># Whether Signer subsequently uses the multisig configuration to generate and verify receive and change addresses.<br><br>An attacker who can modify the multisig configuration can steal or hold funds to ransom by duping the user into sending funds to the wrong address.<br><br>This proposal seeks to address concerns #1 and #2: to mitigate the risk of tampering during the initial setup phase, and to define an interoperable multisig configuration format.<br><br>Concerns #3 and #4 should be handled by Signers and is out of scope of this proposal.<br><br>==Specification==<br><br>===Prerequisites===<br>This proposal assumes the parties in the multisig support [<a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki</a> BIP32], [<a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md" target="_blank">https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md</a> the descriptor language] and encryption.<br><br>==Roles==<br>===Coordinator===<br><br>The Coordinator initiates the multisig setup. The Coordinator determines what type of multisig is used and how many members and signatures are needed. If encryption is enabled, the Coordinator generates a secret token, to be shared among the parties for secure communication. The Coordinator gathers information from the Signers to generate a descriptor record. The Coordinator distributes the descriptor record back to the Signers.<br><br>===Signer===<br><br>The Signer is a participating member in the multisig. Its responsibilities include providing its XPUB to the Coordinator, verifying that its XPUB is included in the descriptor record and persisting the descriptor record in its storage.<br><br>==Setup Process==<br><br>===Round 1===<br><br>====Coordinator====<br><br>* The Coordinator creates a multisig wallet creation session. The Coordinator determines the type of multisig script used and the signing configuration (<tt>M</tt> and <tt>N</tt>).<br>* If encryption is enabled, the Coordinator also generates a secret token, hereby denoted <tt>TOKEN</tt>. <br>* TOKEN is in ASCII format and must have a minimum of 8 characters. TOKEN should expire after some time period determined by the Coordinator, e.g., 24 hours.<br>* TOKEN acts as an encryption key among the parties. The method of encryption is AES, CTR mode. The encryption key can be calculated by performing a double hash operation on the TOKEN: <tt>ENCRYPTION_KEY = SHA256(SHA256(TOKEN))</tt>.<br>* A TOKEN value of <tt>-1</tt> means that encryption is disabled and all the encryption/decryption steps below can be skipped.<br>* The Coordinator shares the TOKEN with all participating Signers over a secure channel.<br><br>====Signer====<br><br>* The Signer generates a key record by prompting the user for the TOKEN and a derivation path.<br>* The first line in the record must be the <tt>TOKEN</tt>. If encryption is disabled, set the TOKEN to -1. The second line must be the <tt>KEY</tt>, whereas KEY is an XPUB. KEY must include key origin information and written in the descriptor-defined format, i.e.: <tt>[{master key fingerprint}/{derivation path}]{XPUB}</tt>. The third line must be a <tt>SIG</tt>, whereas SIG is the signature generated by using the corresponding private key to sign the first two lines. Finally, the Signer encrypts the entire record with ENCRYPTION_KEY.<br><br>===Round 2===<br><br>====Coordinator====<br><br>* The Coordinator gathers key records from all participating Signers. Abort the setup if TOKEN has expired.<br>* For each key record, the Coordinator decrypts it using ENCRYPTION_KEY. The Coordinator verifies that the included SIG is valid given the KEY.<br>* If all key records look good, the Coordinator generates a descriptor record, which is simply the descriptor string plus a <tt>CHECKSUM</tt>, all in one line. The CHECKSUM has BECH32 encoding and is described at [<a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md#checksums" target="_blank">https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md#checksums</a>]. The Coordinator encrypts this descriptor record with ENCRYPTION_KEY.<br>* The Coordinator sends the encrypted descriptor record to all participating Signers.<br><br>====Signer====<br><br>* The Signer imports the descriptor record, decrypts it by prompting the user for TOKEN.<br>* The Signer calculates and verifies the descriptor’s CHECKSUM. Abort the setup if the CHECKSUM is incorrect. <br>* The Signer checks whether one of the KEYs in the descriptor belongs to it, using path and fingerprint information included in the descriptor. The check must perform an exact match on the KEYs, and not using shortcuts such as matching fingerprints (which is trivial to spoof). Abort the setup if it doesn’t detect its own KEY.<br>* For confirmation, the Signer must display to the user the descriptor's CHECKSUM, plus other configurations, such as M and N. The total number of Signers, N, is important to prevent a KEY insertion attack. All participating Signers should be able to display the same confirmation. <br>* If all checks pass, the Signer persists the descriptor record in its storage. The Signer should subsequently use the descriptor to generate and verify receive and change addresses.<br><br>This completes the setup.<br><br>==QR Codes==<br>For signers that use QR codes to transmit data, key and descriptor records can be converted to QR codes, following [<a href="https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md" target="_blank">https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md</a> the BCR standard].<br><br>==Security==<br><br>This proposal introduce two layers of protection. The first one is a temporary, secret token, used to encrypt the two rounds of communication between the Signers and the Coordinator. The second one is through the descriptor checksum and visual inspection of the descriptor itself.<br><br>The token is only needed during the setup phase, and can be safely thrown away afterwards. The token does not guarantee that the Signer membership set is not modified, since that depends on the overall security of all parties in the setup, but it can make it significantly harder for an attacker to do so.<br><br>There are three ways an attacker can modify the membership set: by changing an existing member, by removing an existing member, or by adding a new member.<br><br>For the first two methods, one of the Signers will be able to detect that its membership has been changed or removed, and reject the final descriptor. Thus, it is vital that all participating Signers check that their membership is intact in the descriptor. Even one Signer failing to check for its membership means that the setup could be compromised.<br><br>For the third type of attack, the descriptor checksum and visual inspection of the descriptor itself are the only way to guard against malicious members from being inserted into the set.<br></div></div>
_______________________________________________<br>
bitcoin-dev mailing list<br>
<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" target="_blank">bitcoin-dev@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" rel="noreferrer" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev</a><br>
</blockquote></div>
</blockquote></div></div>