<oembed><type>rich</type><version>1.0</version><title>Kevin Loaec [ARCHIVE] wrote</title><author_name>Kevin Loaec [ARCHIVE] (npub12w…j845v)</author_name><author_url>https://yabu.me/npub12w0x6sueclvy20mq2sfdsj2uu6y6f3hks05vh82wf8fyxqj7y9qqsj845v</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2021-01-14&#xA;📝 Original message:Hello everyone,&#xA;&#xA;I would like to start a discussion on improving Hardware Wallets.&#xA;&#xA;My approach to this right now is from a vault protocol we are developing (Revault, [1]), and its Hardware Wallet&#xA;requirements. I started working on a Github Issue in our repo [2], other people recommended us to do a more general&#xA;discussion on the mailing list instead as it could benefit many other protocols and users.&#xA;This email discusses improvements that would benefit everyone, and some that are more suitable for &#34;layer 2&#34; or pre-&#xA;signed transactions protocols.&#xA;The goal is to spark discussions and hopefully iterate to a more secure and more usable hardware ecosystem for all&#xA;bitcoiners.&#xA;While I mainly foresee issues/improvements that may affect Revault, I would be really happy to see people joining this&#xA;thread with any other ideas and remarks that would benefit some parts of Bitcoin that I overlooked.&#xA;&#xA;&#xA;&#xA;Prior work on similar problematics:&#xA;===================================&#xA;- ZmnSCPx&#xA;j: [Lightning-dev] Speculations on hardware wallet support for Lightning [3]&#xA;- mflaxman: Known Issues: Verifying a Receive Address [4]&#xA;- ksedgwic and devrandom01: Lightning-signer [5]&#xA;- benma: How nearly all personal hardware wallet multisig setups are insecure [6]&#xA;&#xA;&#xA;The postulate we start from is that Hardware Wallets (HW) are useful to mitigate the compromission of the day-to-day&#xA;device of a user. They mainly prevent private-key extraction today, and aren&#39;t very suitable against an attack on the&#xA;transaction being signed, as explained further.&#xA;To make this discussion security-focused, let&#39;s assume the general purpose device (laptop, for example) is compromised&#xA;with a malware implanted by an attacker, capable of modifying PSBTs, displayed addresses, etc.&#xA;&#xA;Our study so far:&#xA;&#xA;&#xA;Output Script Parsing:&#xA;======================&#xA;Problem: A typical HW today would display the &#34;destination&#34; of a transaction in the form of a bitcoin address. A user&#xA;would generally compare this wit&#xA;h the address displayed on his laptop screen... which might have been compromised&#xA;already. The correct usage would be for a user to verify this address on a third device (mobile phone, for example).&#xA;This is weak security and bad user experience.&#xA;Proposed improvement: The HW should display the Bitcoin Script itself when possible (including the unlock conditions).&#xA;The best way to do so would be to lift this Script to a more user-friendly format such as a MiniScript Policy display,&#xA;but anything would be better than an &#34;address&#34;.&#xA;This applies to pre-signed transaction protocols especially well as the template of these transactions could be known&#xA;and recognized by the HW. Typically for Revault, the HW could display: &#34;Unvault Transaction, all expected pubkeys&#xA;present in the script&#34;.&#xA;&#xA;&#xA;Pubkey Interpretation:&#xA;======================&#xA;Problem: currently HW cannot &#34;identify&#34; addresses or keys.&#xA;Proposed improvement: The HW could know pubkeys or xpubs it does not hold the private keys &#xA;for, and display a label (or&#xA;understand it for logic reasons, such as &#34;expected pubkeys&#34; as the previous example). Going further, the xpubs could be&#xA;aliased the first time they are entered/verified (as part of, say, an initial setup ceremony) for instance with the&#xA;previously mentioned Miniscript policy: or(pk(Alice), and(pk(Bob), after(42))).&#xA;This should be done in the Secure Element if possible to avoid physical compromission, but would be a strong improvement&#xA;versus a day-to-day laptop in any case.&#xA;&#xA;&#xA;Better Bitcoin Compatibility:&#xA;=============================&#xA;Problem: most HW cannot interpret some Script OPs such as OP_CSV, or any conditional outputs. This is a major issue for&#xA;anyone using Bitcoin &#34;advanced&#34; features. Related to this are the Sighash flags: most HW do not support most Sighash&#xA;flags. Kind of annoying for a signing device. Then there is PSBT support and the maximum transaction size limit for&#xA;these: we need more transparency from HW manufacturers on their li&#xA;mitations.&#xA;Solution: Make Bitcoin HW actually compatible with Bitcoin :D&#xA;&#xA;&#xA;Inputs (mainly for pre-signed Tx):&#xA;==================================&#xA;Problem: Poisoned inputs are a major risk for HW as they don&#39;t know the UTXO set. While this can be exploited for fee&#xA;attacks, it is a bigger threat to pre-signed transactions protocols. Once any input of a (pre-signed)transaction is&#xA;spent, this transaction isn&#39;t valid anymore. Most pre-signed transactions protocols are used today as a form of defense&#xA;mechanism, spending any input would mean incapacitating the entire defense mechanism.&#xA;Proposed improvement: for protocols that requires it, keeping track of inputs already signed once would be extremely&#xA;helpful. Going further, most of these protocols require to follow a specific signing order (typically the &#34;clawback&#34;&#xA;first, then the regular spend path) so adding a way to check that a &#34;clawback&#34; has been signed first, with the same&#xA;input, would be very helpful. All of this on the dev&#xA;ice itself.&#xA;&#xA;&#xA;&#xA;&#xA;I understand some of these changes may be very difficult, especially given the low memory and computational power of&#xA;secure elements. However I truly believe most of these points are a MUST have for any decent security. If you don&#39;t&#xA;assume the computer on which the transaction is crafted is compromised, then you don&#39;t need a hardware wallet. If you&#xA;assume it may be compromised, then the HW needs to be able to defend against those.&#xA;&#xA;Revault does not plan on building hardware wallets, we hope existing and upcoming manufacturers will implement a strong&#xA;security that we could use for the Revault protocol users. Vault users will likely hold very large sums and would be&#xA;happy to pay a high premium for more secure HW. This will hopefully encourage existing players to keep on improving&#xA;their devices and that will ultimately benefit us all.&#xA;&#xA;Feel free to reply with your comments or adding suggestions, I am not a hardware wallet expert and would take criticism&#xA;wit&#xA;hout being offended.&#xA;&#xA;Kind Regards,&#xA;Kevin Loaec&#xA;&#xA;[1]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-May/017835.html&#xA;[2]: https://github.com/re-vault/practical-revault/issues/59&#xA;[3]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002425.html&#xA;[4]: https://btcguide.github.io/known-issues/verify-receive-address&#xA;[5]: https://gitlab.com/lightning-signer/docs&#xA;[6]: https://shiftcrypto.ch/blog/how-nearly-all-personal-hardware-wallet-multisig-setups-are-insecure/&#xA;&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: publickey - kevin at revault.dev - 7c1d686c.asc&#xA;Type: application/pgp-keys&#xA;Size: 643 bytes&#xA;Desc: not available&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210114/7adc4c33/attachment.bin&gt;&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: signature.asc&#xA;Type: application/pgp-signature&#xA;Size: 233 bytes&#xA;Desc: OpenPGP digital signature&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20210114/7adc4c33/attachment.sig&gt;</html></oembed>