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