<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kaspar Etter on Medium]]></title>
        <description><![CDATA[Stories by Kaspar Etter on Medium]]></description>
        <link>https://medium.com/@KasparEtter?source=rss-486fa9d33538------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LiBU8qagekPABO17VpPiog.jpeg</url>
            <title>Stories by Kaspar Etter on Medium</title>
            <link>https://medium.com/@KasparEtter?source=rss-486fa9d33538------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 21:06:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@KasparEtter/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The pitfalls of multisig when using hardware wallets]]></title>
            <link>https://medium.com/shiftcrypto/the-pitfalls-of-multisig-when-using-hardware-wallets-9b0e98e4c19c?source=rss-486fa9d33538------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b0e98e4c19c</guid>
            <category><![CDATA[ledger]]></category>
            <category><![CDATA[trezor]]></category>
            <category><![CDATA[multisig]]></category>
            <category><![CDATA[hardware-wallet]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Kaspar Etter]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 17:01:28 GMT</pubDate>
            <atom:updated>2019-12-04T09:23:41.146Z</atom:updated>
            <content:encoded><![CDATA[<p>Instead of holding your bitcoins with a single set of keys, you can also hold your bitcoins with several sets of keys. This is known as <a href="https://en.bitcoin.it/wiki/Multisignature">multisignature</a>, or multisig for short, which requires multiple signatures to authorize a Bitcoin transaction. You can determine both the overall number of keys and the threshold required to spend the coins. If you choose a threshold bigger than one, an attacker who learns one of the keys can still not steal your funds. This is why many people in the field <a href="https://bitcoin-hardware-wallet.github.io/">recommend</a> that everyone should use multisig to secure their coins. However, this article explains why the increased complexity of using multisig instead of singlesig has its own pitfalls. Included are responsible disclosures we made to <a href="https://satoshilabs.com/">SatoshiLabs</a> (producing Trezor) and <a href="https://www.ledger.com/">Ledger</a> in this regard, which we haven’t published before.</p><h3>Why are we investigating our competitors?</h3><p>When implementing experimental support for multisig in the <a href="https://shiftcrypto.ch/app/">BitBoxApp</a>, I made my colleague <a href="https://twitter.com/_benma_">benma</a> aware that the receive address screen of his Trezor cannot be trusted in case of multisig (see below for more details). After realizing how important it is to handle <a href="https://medium.com/shiftcrypto/bitbox-desktop-app-4-6-0-with-firmware-6-0-3-release-ec46937afe7c#ecd1">change addresses</a> similarly to <a href="https://medium.com/shiftcrypto/bitbox-desktop-app-4-5-0-with-firmware-6-0-2-release-fd77f8186a29#3a25">receive addresses</a> earlier this year, we were getting more curious about how other hardware wallets handle multisig. We launched the <a href="https://shiftcrypto.ch/bitbox02/">BitBox02</a> at the end of September and finally had some time to look at other hardware wallet implementations, also in order to evaluate how much effort is required to properly add multisig ourselves. We stumbled over several issues, which resulted in responsible disclosures to <a href="https://medium.com/shiftcrypto/a-remote-theft-attack-on-trezor-model-t-44127cd7fb5a">Trezor</a>, <a href="https://medium.com/shiftcrypto/a-ransom-attack-on-coldcards-change-and-keypath-verification-f3c71461624a">Coldcard</a> and Ledger (as discussed here).</p><h3>Why should I use a hardware wallet?</h3><p>I went into more details in a <a href="https://medium.com/shiftcrypto/how-we-do-security-assessments-at-shift-c85a0c648283">previous blog post</a>, but in short, a hardware wallet should allow you to securely receive and spend funds, as well as securely receive the change back to the same account, even when your computer or mobile phone has malware. While each manufacturer can define what their product does and does not protect you against, we think that the threat model for hardware wallets should include malicious or compromised cosigners in case of multisig. The reason for this is that companies are interested in using multisig as part of coin storage, rate-limiting, or inheritance services. If their infrastructure gets compromised, a lot of users could be affected — especially if they use the service provider’s app to interact with their hardware wallet.</p><h3>What is the motivation for using multisig?</h3><p>There are two main use cases for multisig: (i) sharing the authority to spend coins among several parties with no single point of failure or (ii) reducing the impact of vulnerabilities by using hardware wallets from different manufacturers. In both scenarios, you should pay attention to certain things. Otherwise, you might end up with less security than if you were using ordinary singlesig. Multisig adds complexity for the hardware wallet, the software wallet, and for you, but “complexity is the enemy of security”. Moreover, because singlesig is much more popular than multisig, companies pay more attention to the security and usability of their singlesig workflow rather than their multisig implementation. While I agree that multisig is more secure in theory, the following sections outline why this sometimes might not be the case in practice.</p><h3>How can you back up the multisig setup securely?</h3><p>The first pitfall occurs before you even start receiving or spending money. Assume you create, for example, a 2 out of 3 setup, where the threshold is smaller than the number of cosigners. In other words, 2 signatures are required out of 3 possible signatures to approve a transaction. It is absolutely crucial that each cosigner’s backup includes the extended public keys (xpubs in short) of all other cosigners (at the multisig account keypath and ideally together with the used threshold, derivation path and script type). Otherwise the loss of a single seed means that you can no longer recover and spend the funds. This is because unspent transaction outputs of multisig accounts are locked with the hash of all public keys (and the threshold). Technically, if you can no longer derive the public keys of all cosigners, you can no longer determine the <a href="https://bitcoin.org/en/transactions-guide#multisig">redeem scripts</a> necessary to find and spend the UTXOs of your multisig account. For example, if you set up a 2 out of 3 multisig account but forget to also back up the extended public keys of the other two cosigners, then two out of three are enough to spend and receive money as long as the individual (hardware) wallets are functional. However, if you all lose access to your wallets for whatever reason, you need all three seed backups instead of just two for recovery.</p><h3>How can you receive coins securely with multisig?</h3><p>Your hardware wallet should verify, or let you verify, the following information provided by the untrusted computer:</p><ul><li>The receive address, which has to encode the hash of an ordinary multisig redeem script with no other spending conditions</li><li>The key of the hardware wallet, which has to be one of the public keys in the redeem script</li><li>The keypath of the displayed address in order to avoid <a href="https://blog.sia.tech/a-ransom-attack-on-hardware-wallets-534c075b3a92">ransom attacks</a> if no restrictions are enforced by the hardware wallet</li><li>The number of cosigners in order to prevent an attacker from adding more</li><li>The threshold of required signatures to not be higher or lower than intended</li><li>The xpubs of the cosigners in order to prevent an attacker from swapping them</li></ul><p>In order to avoid a single point of human failure when using a receive address, the same threshold of cosigners should confirm to the sender that the receive address has been transmitted correctly. If you are using a multisig setup in order to avoid the risk of a vulnerability in the firmware of a particular device, you should check the receive address on multiple hardware wallets. Receiving coins securely is just as important as spending coins securely.</p><p>So how do different hardware wallets handle this?</p><p>As others have noticed before, <a href="https://twitter.com/mflaxman/status/1154538947340468224">Ledger does not handle this</a>. Instead, the user needs to trust the receive address that is displayed on the computer, contrary to the purpose of a hardware wallet.</p><p>Trezor verifies that its key is part of the properly formed receive address and displays to the user all other information (see once more the above <a href="https://twitter.com/mflaxman/status/1154538947340468224">tweet on Ledger</a>) except the cosigners. For simplicity, manufacturers try to keep the firmware of hardware wallets as <a href="https://en.wikipedia.org/wiki/Stateless_protocol">stateless</a> as possible and consequently try to avoid storing anything but the seed. Until the firmware version 2.1.8 was released on 6 November 2019, there was no way for the user to verify the xpubs of the cosigners provided by the computer. <strong>In other words, malware could replace the xpubs of the two cosigners in our 2 out of 3 multisig example above, and the attacker would then fully control the received coins.</strong> This is a real problem as users are educated to trust the screen of their hardware wallet but are not educated about the above replacement risk that makes the device screen untrustworthy in case of multisig. This is the second vulnerability we disclosed to Trezor and it is mentioned in the <a href="https://github.com/trezor/trezor-firmware/blob/5e7dd41613cbd3aeaadc71fa03027faa813a3691/core/ChangeLog#L9">release notes</a>. They considered it to be more of a usability problem rather than a security one. (As long as you check the receive address on multiple devices that each confirms its key is included in the multisig address, this would indeed not be a security issue.) While the new firmware still does not persist your multisig configuration, you can now verify the xpubs of your cosigners when displaying a multisig receive address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*b1jafnBgUub1xm-f2Gcrmw.gif" /><figcaption>How to check the xpubs of your multisig cosigners on Trezor Model T.</figcaption></figure><p>Inconveniently, as far as we can tell, the Trezor does not indicate which xpub is yours. Since the hardware wallet provides your own xpub, you wouldn’t have to verify it yourself. On the other hand, as there seems to be no other method to display your own xpub on the trusted screen of your Trezor, at least you can now tell your cosigners with more confidence what your own xpub is.</p><p>Coldcard has the best approach by persisting the multisig configuration after an initial setup. However, it had a problem with the sanitization of the derivation keypath, which we <a href="https://medium.com/shiftcrypto/a-ransom-attack-on-coldcards-change-and-keypath-verification-f3c71461624a#165b">responsibly disclosed</a> to them.</p><h3>How can you spend coins securely with multisig?</h3><p>Once you managed to receive some coins securely, how can you spend them with confidence? The hardware wallet has to verify, or let you verify, the following information provided by the untrusted computer:</p><ul><li>The recipient’s address, displayed and confirmed by the user like with singlesig</li><li>The change address, having the same cosigners and threshold in an ordinary multisig script with no other spending conditions</li><li>The change goes to an address at a keypath recoverable by the user</li></ul><p>So how do different hardware wallets handle this?</p><p>By checking the multisig configuration, Coldcard has the best approach. However, by not enforcing enough restrictions on the keypath, the change is not ensured to be accessible. We <a href="https://medium.com/shiftcrypto/a-ransom-attack-on-coldcards-change-and-keypath-verification-f3c71461624a#b808">responsibly disclosed</a> this issue, and it was fixed in the <a href="https://github.com/Coldcard/firmware/blob/5475bdb0c7994cda3ae9e5fe0b2812ca19b19816/releases/ChangeLog.md#302---nov-1-2019">firmware 3.0.2</a> released on 1 November 2019.</p><p>Trezor verifies that the change goes back to the same wallet account (with the same cosigners and threshold) but had a mistake in its verification. Because Trezor did not properly separate the singlesig and multisig workflows, an attacker could (i) add a shared multisig input to a singlesig transaction, then (ii) send the change to the same multisig account and (iii) steal all the user’s funds from there. We reported this critical remote attack on 1 October 2019, which was fixed in the firmware version 2.1.8 released on 6 November 2019. (See this <a href="https://medium.com/shiftcrypto/a-remote-theft-attack-on-trezor-model-t-44127cd7fb5a">writeup</a> by benma for more information.) Other than that, their approach to neither persist, nor let the user confirm, the xpubs of the cosigners works for spending because the <a href="https://bitcoin.org/en/transactions-guide#multisig">redeem script</a> with the public keys of the cosigners is part of the hash that is being signed. Consequently, if malware on your computer lies about the xpubs of your cosigners when signing a transaction, other nodes in the Bitcoin network would reject the invalid transaction.</p><p>As Saleem Rashid already pointed out almost two years ago, <a href="https://saleemrashid.com/2018/01/27/hardware-wallet-electrum-multisig/">Ledger leaves the change output for the user to confirm</a> in case of multisig transactions, which leads to various problems. How are users supposed to verify the change address? If they need a separate, fully trustworthy computer for this, why would they need a hardware wallet in the first place? If we assume that the user must confirm the change address with the cosigner, then this leads to the following two issues:</p><ol><li><strong>Send-to-many not clearly distinguishable from multisig</strong>: The only way users can tell whether they are signing a multisig rather than a send-to-many transaction is that they get a change keypath warning in the former case but not in the latter. Ordinary users cannot be expected to notice the difference and multisig users are familiar with the process of always confirming something more than the intended recipient on a Ledger. Hence a compromised cosigner can provide a send-to address that they alone control and have it be mistakenly confirmed as a multisig “change” address.</li><li><strong>Reducing the multisig threshold</strong>: If you have an M out of N multisig setup, you cannot detect when the multisig threshold of the change output is lowered to 1 out of N. In case a compromised cosigner lies to you about what is the change to be confirmed, they can steal the change after the transaction is completed.<br>While these two problems are solved if users have access to a change oracle that tells them what the change has to look like, there is another issue users cannot protect against:</li><li><strong>Singlesig inputs to multisig change</strong>: If the user also holds singlesig funds on the same Ledger, an attacker can fund a multisig transaction that the user wants to perform with their singlesig UTXOs instead of taking them from the multisig account. If the multisig account has a 1 out of N configuration, a malicious or compromised cosigner can spend the change immediately afterwards. In other words, due to this design choice, a Ledger does not verify that the change goes back to the same account, which puts your singlesig (and other multisig) funds at risk.</li></ol><p>Please note that these attacks require that the victim’s computer is compromised, which is a common assumption for the <a href="https://medium.com/shiftcrypto/how-we-do-security-assessments-at-shift-c85a0c648283#a635">threat model of hardware wallets</a>. We reported all three issues to Ledger on 4 November 2019. They responded that this is all expected behavior, and that they are working on a new Bitcoin application that should address these issues (see <a href="https://old.reddit.com/r/ledgerwallet/comments/csqwwj/any_plans_to_resolve_these_issues/exgw9pt/">this comment</a> on Reddit for more information). <strong>If you do use your Ledger both for singlesig and multisig and wouldn’t trust your cosigners with your singlesig funds, we recommend to first move your singlesig funds to a different wallet before you sign further multisig transactions.</strong> Moreover, we recommend to use a single Trezor or Ledger device for at most one multisig setup because you cannot know from which account you are spending as the account is not displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*R1mIc0_tRWlnNPQONNO9cA.gif" /><figcaption>A recording of the multisig workflow on a Ledger Nano X.</figcaption></figure><h3>What do all attacks have in common?</h3><p>The source of all vulnerabilities mentioned here is that the hardware wallets either try to be smart and display as little as possible (Trezor and Coldcard) or try to be dumb and display more (Ledger), but both approaches failed, i.e. they neither verified enough nor displayed enough. Striking a balance between the two with the right amount of silent verification and user confirmation is not easy. Moreover, it seems to me that this family of “change the change” attacks needs closer attention. All of the attacks mentioned in this article were (or still are) remote attacks, where a compromised computer can simply misuse the API of the hardware wallet. For ideas about what hardware wallets could do to mitigate such attacks and therefore improve their security, check out <a href="https://medium.com/shiftcrypto/a-remote-theft-attack-on-trezor-model-t-44127cd7fb5a#8b10">benma’s article</a>. And while this article focuses on hardware wallets, it’s important to note that with the use of multisig, software wallets are vulnerable to API misuse attacks too as transactions can be passed to them similar to hardware wallets.</p><h3>Acknowledgments</h3><p>Credits go to <a href="https://twitter.com/the_charlatan_">TheCharlatan</a> for figuring out that you can send singlesig funds to multisig change with a Ledger and to <a href="https://twitter.com/_benma_">benma</a> for questioning the assumption that cosigners are trustworthy, while I refined the above attacks and reported them to Ledger. TheCharlatan also took care of replicating them with changes to the <a href="https://electrum.org/">Electrum wallet</a> and <a href="https://github.com/bitcoin-core/HWI">HWI</a>. This concludes our vulnerability disclosure trilogy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b0e98e4c19c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shiftcrypto/the-pitfalls-of-multisig-when-using-hardware-wallets-9b0e98e4c19c">The pitfalls of multisig when using hardware wallets</a> was originally published in <a href="https://medium.com/shiftcrypto">ShiftCrypto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we do security assessments at Shift]]></title>
            <link>https://medium.com/shiftcrypto/how-we-do-security-assessments-at-shift-c85a0c648283?source=rss-486fa9d33538------2</link>
            <guid isPermaLink="false">https://medium.com/p/c85a0c648283</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[hardware-wallet]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[vulnerability-assessment]]></category>
            <dc:creator><![CDATA[Kaspar Etter]]></dc:creator>
            <pubDate>Mon, 02 Dec 2019 14:06:59 GMT</pubDate>
            <atom:updated>2019-12-02T14:38:55.435Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the last two years, security researchers reported to us several vulnerabilities in the BitBox01, and we found some internally. Through this process we gained some experience with assessing their severity. With our recent responsible disclosures to our competitors, we realized that the industry of hardware wallets lacks a common standard for severity assessments. This blog post outlines how we evaluate vulnerabilities at Shift. By publishing our framework, we hope to get feedback and to move the industry forward. We are aware that our classification isn’t perfect, but we haven’t yet found a more suitable model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9oTfqJDG3Y4s7O66_d19xQ.png" /></figure><h3>Threat model of hardware wallets</h3><p>Before we dive into potential vulnerabilities, let’s first discuss why a hardware wallet is still the best means to hold your cryptocurrencies despite reported vulnerabilities. Devices like computers and mobile phones, which could be used to store a wallet’s private keys, run highly complex general purpose operating systems with millions of lines of code and have weak security domains. Unlike those devices, hardware wallets typically only run dedicated firmware without any user-provided code and are built for a single purpose: keeping your private keys private. This reduces the attack surface a lot, which means attackers have fewer options to steal your private keys and thus your funds. In order to be secure, you should always trust the screen of your hardware wallet over the information displayed on your computer and verify carefully what is displayed on your hardware wallet. The manufacturer can add exceptions to this rule, for example when your computer warns you about a failed <a href="https://shiftcrypto.ch/bitbox02/threat-model/#evil-maid-attacks">device authenticity check</a> (i.e. you may have a potentially counterfeit device). Protection against malware on your computer is the bare minimum a hardware wallet should provide in terms of security. Most hardware wallets also aim to protect your assets from theft when your device is stolen by encrypting sensitive information and requiring a PIN or password to unlock the device.</p><p>While the above might seem trivial, there are many situations where the covered security threats are not clearly defined. This is why it’s important that hardware wallet companies publish a threat model, where they explain what they protect you against and — more importantly — what not. Here are some examples to illustrate why the scope of attacks and countermeasures is not trivial and needs to be made explicit: What are the mechanisms in place to prevent tampering in the supply chain before the device reaches you? Are <a href="https://en.wikipedia.org/wiki/Evil_maid_attack">evil maid attacks</a> in scope or out-of-scope? How can you be sure that the firmware binary you install on your device is the one for which the code is published and which everyone else is receiving? Or is the company being forced to sign a malicious firmware just for you? Can you trust the receive address for a multisig account that is displayed on your hardware wallet? Are you still secure if the cosigner of a multisig setup is malicious or compromised? We will come back to the last two questions in a future blog post. You find the answers to all the other questions regarding the BitBox02 in our <a href="https://shiftcrypto.ch/bitbox02/threat-model/">threat model</a>. The only other threat model we are aware of is the page on <a href="https://wiki.trezor.io/Security:Threats">security threats by Trezor</a>. Ledger lists which vulnerabilities are in-scope and which are out-of-scope in their <a href="https://donjon.ledger.com/bounty/">bug bounty program</a>.</p><h3>Severity = impact * scalability</h3><p>The risk of a particular vulnerability for users, and thus its severity, is determined by multiplying the impact by the likelihood of the exploit. In general, the easier it is to perform an attack at scale, the more likely it is that you are affected. In particular, since it is easier to distribute malware than to steal a large number of used devices, you are more likely to be a victim of software-based attacks, also known as remote attacks, than hardware-based attacks. However, this depends a lot on your personal situation. If you are a high-profile individual or bring your hardware wallet to cryptocurrency meetups and forget it there, then the situation can be different for you. For simplicity, we assume here that the likelihood of you being attacked based on a particular vulnerability scales proportionally with the overall number of users that the given attack could target simultaneously.</p><h3>Impacts of vulnerabilities</h3><p>By finding and exploiting a vulnerability, an attacker can achieve one of the following outcomes, listed in order of decreasing severity:</p><ul><li><strong>Seed extraction/injection</strong>: The worst outcome is when the attacker learns the seed of your wallet, from which all keys are derived. An attacker can steal your funds immediately or wait until you accumulate more coins and tokens; then withdraw all your funds when you least expect it. This delay from the attack to the time of exploitation makes it harder to link the attacker to the attack and find the vulnerability. Furthermore, unlike in the case of stealing funds, where the problem is typically in the transaction signing implementation of a particular coin, learning the seed compromises all your funds and potentially other features like U2F/SSH authentication or email signing/decryption. An attacker knows the seed if they manage either to extract it from the hardware wallet or to inject it into the hardware wallet when the user sets up the wallet.</li><li><strong>Key extraction</strong>: Instead of extracting the seed, an attacker could succeed in extracting an individual key. This could be due to a faulty signing algorithm (such as <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Security">reusing the nonce</a>) or due to a <a href="https://en.wikipedia.org/wiki/Side-channel_attack">side-channel</a>. The consequence of extracting the key varies by cryptocurrency. With Bitcoin, you should not reuse keys (and thus addresses) and therefore the damage is limited to the coins you hold with that particular key. With Ethereum and ERC20 tokens, your account consists of a single key, which makes a key compromise as severe as a seed extraction.</li><li><strong>Theft</strong>: Without extracting any keys from the hardware wallet, an attacker might succeed in stealing your funds, typically either when receiving or spending them. When receiving coins, it’s very important that you let the hardware wallet display the receive address and then confirm the address with the sender through a different channel than your computer. Otherwise, a malware can simply replace the receive address displayed by your wallet software or sent by you to the sender. When a hardware wallet is involved, thefts can still happen when what you see and confirm on the hardware wallet is not what you intended to confirm with no fault of your own. Due to an error, the firmware might not properly verify the received data or might not display all relevant information to keep your funds secure. We will cover examples of this in a future article about pitfalls of multisig.</li><li><strong>Ransom</strong>: Instead of stealing your coins, an attacker might achieve to hold your funds hostage so that you can no longer spend them without the attacker’s assistance. While less convenient than stealing your coins directly, the concept of <a href="https://en.wikipedia.org/wiki/Ransomware">ransomware</a> exists for quite some time and should be taken seriously. An example of a ransom attack is the misuse of the unlimited number of key derivations possible from the seed of the wallet. If the hardware wallet does not enforce enough restrictions, an attacker can provide a derivation path for the receive or change address to the hardware wallet that is unknown to the user and delete it immediately afterwards on the user’s system. According to the defacto standard defined in <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki">BIP32</a> and used by virtually all wallets, there are 2³² child keys for each key. This means the space of all keys in Bitcoin is surpassed with only eight unrestricted derivation levels. If an attacker manages to bury your funds so deep in the derivation tree, it becomes easier to brute-force Bitcoin private keys, which is computationally infeasible, than to recover your funds from the seed.</li><li><strong>Destruction</strong>: While permanently destroying your access to your funds is less attractive for a financially motivated attacker, it might still be an attractive attack for a disgruntled employee or competitor. While I’m not aware of such an attack on any hardware wallets, it is also something they should protect you from. If the firmware is not carefully written, a <a href="https://en.wikipedia.org/wiki/Glitch">glitch</a> induced during a critical operation such as the key derivation for the change address might be able to send some coins into a digital nirvana. Please note that erasing the seed from a hardware wallet does not qualify as permanent destruction: The user should still have a backup from which they can recover their funds.</li><li><strong>Loss of plausible deniability</strong>: Some hardware wallets have features that allow you to unlock a different wallet under duress. An example for this is the optional passphrase in the <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki">BIP39</a> standard, whereby each passphrase derives a valid wallet. If you deposit some coins in a second wallet beforehand and unlock that one when you’re threatened, you might be able to hide the existence of other wallets on the same device. If a hardware wallet provides a similar functionality not based on BIP39 and which is not carefully designed, measuring the execution speed or probing communication on the physical wires inside the hardware wallet could reveal whether you are using the main or a hidden wallet, destroying plausible deniability for you.</li><li><strong>Loss of privacy</strong>: While not putting your funds in danger, vulnerabilities in the API of the hardware wallet or the persistence of information could reveal your balance to an attacker, for example by returning an extended public key without having to unlock the device first.</li><li><strong>Bricking of device</strong>: The least severe consequence is a bug or a weakness that makes your hardware wallet permanently unusable. While this would certainly be annoying, you can recover your funds from your backup on a new wallet. The manufacturer could even replace bricked devices free of charge. For this to be nothing more than an annoyance, though, it is absolutely crucial that you can recover your funds from your backup. We recommend practicing this procedure before storing funds on your hardware wallet and then routinely afterwards.</li></ul><h3>Scalability of vulnerabilities</h3><p>Vulnerabilities can differ drastically with regards to how easy they are to exploit at scale. As mentioned above, the more users that can be attacked, the more likely you are one of them. Exploits where the attacker doesn’t have to be physically present are easier to scale. The following attack vectors are listed in order of decreasing scalability and thus decreasing severity.</p><h4>Remote attacks (performed with software)</h4><p>In the hardware wallet industry, attacks that can be performed from the computer to which the hardware wallet is connected are considered to be remote: no physical access to the device is required as the exploit happens through the API of the hardware wallet. How you get malicious software on your computer is outside the scope of this article, but, as noted in the threat model above, this is the main attack vector hardware wallets should protect you from. Remote attacks are really bad as they can scale quickly. For example, the download server of the manufacturer’s wallet software can get compromised and most users would likely install a malicious app as they don’t verify the signatures on the downloaded binaries. The following distinctions depend on the logic of the hardware wallet and do not apply to all products equally.</p><ul><li><strong>Without unlocking</strong>: The most severe remote attack is when the device does not even have to be unlocked in order to be exploitable. While a user typically connects a hardware wallet to a computer in order to unlock and use it, an exploit without unlocking might also be possible via websites that you visit through the U2F interface, which quite a few hardware wallets support. Additionally, depending on the nature of the vulnerability and the architecture of the hardware wallet, it could put further, unlocked wallets on the device at risk (e.g. the ones you created for plausible deniability). Exploits without unlocking are also very useful for attackers who gain physical possession of your hardware wallet.</li><li><strong>Unlocked without user interaction</strong>: If the vulnerability is exploitable without the user having to confirm anything on the device, like a transaction to be signed or the display of a receive address, then the vulnerability exposes you to the risk of being compromised before upgrading to the fixed firmware. In case of such vulnerabilities, all users of the affected hardware wallet should upgrade the firmware of their devices as soon as possible before the exploit is performed in the wild.<br>Whoever detected the vulnerability should coordinate the public disclosure with the vendor to give users potentially more time to upgrade if the public patch does not make the attack apparent anyway. This also applies to remote attacks without unlocking. As a user of a hardware wallet, make sure that you are subscribed to the manufacturer’s mailing list for security announcements, in particular for situations like this one. (Click <a href="https://groups.google.com/a/shiftcrypto.ch/group/security-announce/subscribe">here</a> to subscribe to Shift’s security announce mailing list.)</li><li><strong>Unlocked with user interaction</strong>: If the vulnerability can only be exploited when the user performs a particular action such as signing a transaction, then users can simply upgrade the firmware before performing the affected action the next time. Therefore, if the wallet software prompts you to install a newer firmware with security fixes, make sure you always upgrade your device before doing anything else on it.</li></ul><h4>Supply chain attacks</h4><p>A hardware wallet or its accessories like the USB cable can be tampered with before it reaches you. This kind of attacks are significantly costlier to perform than software-based remote attacks, since it involves physical modification or replacement of components. Depending on where in the supply chain the attack is performed, such attacks could also scale quite easily. However, as sophisticated supply chain attacks are hard to protect against, they are often not covered in the threat model of hardware wallets.</p><h4>Local attacks (performed with hardware)</h4><p>If, in order to exploit a vulnerability, the attacker needs physical access to the device after the user has already created a wallet on it, then we talk about a local attack. Please note that the boundary between local attacks and supply chain attacks is vague, as many local attacks can be transformed into supply chain attacks with some effort.</p><ul><li><strong>Non-invasive without returning to user</strong>: If a found or stolen device doesn’t have to be cracked open and doesn’t have to be returned to the user in order to exploit a vulnerability, then such an attack is easier to scale than the other local attacks as the device just has to be plugged in. Once built, no knowledge about embedded systems is required and thus the equipment to perform the attack can become attractive on the black market.</li><li><strong>Invasive but non-destructive</strong>: As the casing of most hardware wallets is plastic, they are not difficult to open or at least penetrate so that an attacker can, for example, intercept and change the communication between components in the hardware wallet. The device might get damaged but is not destroyed in the process, so the attacker gets many attempts to perform an attack, unless this is prevented by some brute-force protection mechanism. However, since the device is locked for the attacker, this brute-force protection mechanism is often what they are trying to bypass.</li><li><strong>Invasive and returned to user</strong>: If the hardware wallet or its accessories are not just modified but also returned to the user, then this is known as an evil maid attack. It’s quite difficult to secure the device against this kind of attacks, when performed well, and for this reason these attacks are often excluded from the threat model of hardware wallets. To some degree users can protect themselves against evil maid attacks, or at least make them more difficult to perform, by carefully inspecting the device and by using preventive measures like our recently announced, reusable <a href="https://tep.shiftcrypto.ch/">tamper-evident packaging solution</a>.</li><li><strong>Invasive and destructive</strong>: Last but not least, there are intrusions that are destructive such as <a href="https://en.wikipedia.org/wiki/Decapping">decapping</a> a chip. This is where the promise of secure chips come in, as they are designed to self-destruct before their memory can be read out. If a hardware wallet doesn’t have a secure chip or doesn’t use it properly, it cannot avert such attacks. The security of the hardware wallet then depends solely on the strength of the user-chosen device password.</li></ul><h3>Other aspects to address</h3><p>The above scales for the impact and scalability of vulnerabilities are sometimes too simplistic. Often there are additional aspects to consider on a case-by-case basis. The following questions are examples of aspects that should also be addressed by the vendor if applicable when informing its users about a vulnerability:</p><ul><li>Which coins are affected by the vulnerability?</li><li>Which action is affected? In case of receive address or transaction signing, is singlesig, multisig or both affected?</li><li>Can users protect themselves by choosing stronger passwords, for example in case of brute-forcing attacks?</li><li>Is the vulnerability only present during the creation of a wallet or also while using the wallet? And if you were a victim before upgrading to the firmware that fixes the problem, are you still a victim after the firmware upgrade? If yes, you have to move your funds to a new wallet. An example attack for this case is the injection of a seed known to the attacker when creating the wallet.</li><li>Can the attack be avoided if the user is educated regarding what to pay attention to? Some solutions work better in theory than in practice but could still be the only possible mitigation. An example for this are the LED blinks of the discontinued <a href="https://shiftcrypto.ch/bitbox01/">BitBox01</a>, which we made <a href="https://guides.shiftcrypto.ch/bitbox01/other/blink/">distinguishable</a> to let users know what they confirm when touching the device. As a consequence, having well-informed users is part of our threat model for the BitBox01.</li><li>Can the vulnerability only be exploited when the device is directly connected to a (compromised) computer or also when it’s used in a disconnected, so-called air-gapped mode of operation? Remote attacks that do not require user interaction are not possible when the device is not directly connected to a computer and the user has to transport all messages back and forth, for example, with a microSD card or QR code readers. My impression, though, is that misuses of the API with confirmation by the user when the device is unlocked are much more common than the other remote attacks and an air gap does not help with those.</li><li>More for the curiosity of the community and a potential forensic analysis: Does the attack leave traces on the public blockchain or somewhere else?</li><li>And last but not least: Can the vulnerability be patched?</li></ul><h3>Severity assessment</h3><p>The adjectives typically used to label the severity of a vulnerability are in order of decreasing severity: critical, high, moderate, and low. There can be reasonable disagreement about how to apply these labels to vulnerabilities, or in other words, how to quantify the impact and scalability of attacks. Given the considerations in the previous sections, we define them along the following lines:</p><ul><li><strong>Critical</strong>: All remote attacks up to and including locking the user’s funds for ransom because they can be performed by a financially motivated attacker at scale with zero marginal costs.</li><li><strong>High</strong>: Attacks that permanently destroy access to your funds. We classify such vulnerabilities to be of high severity instead of critical because they are more likely exploited for targeted attacks, as there is no direct financial gain for the attacker. Non-destructive attacks on stolen devices up to and including the consequence of destroying funds also fall in this category.</li><li><strong>Moderate</strong>: Loss of plausible deniability or loss of privacy. We consider them to be of moderate severity because we don’t guarantee the plausible deniability and because the wallet software typically learns the balance and transaction history of your accounts anyway. Assuming your computer is compromised implies assuming that the attacker knows your balance. Destructive attacks that result in theft of your coins also belong here, unless the hardware wallet has no secure chip, in which case they are likely excluded from the threat model.</li><li><strong>Low</strong>: Everything else, including for example supply chain and evil maid attacks, which are mostly excluded by our <a href="https://shiftcrypto.ch/bitbox02/threat-model/">threat model</a>. The situation is different when a mechanism fails that was put in place to make such attacks harder and which was advertised as such.</li></ul><p>Since many vulnerabilities have aspects that make them “special” as highlighted by the questions in the previous section, we reserve the right to deviate from these rules in our <a href="https://shiftcrypto.ch/bug-bounty-program/">bug bounty program</a> at our sole discretion. Furthermore, it is often not clear what the impact of a potential vulnerability is, especially in the case of memory issues such as <a href="https://blog.inhq.net/posts/u2fhid_init_resp-information-leak/">leaking some bytes</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjiNummm7va7LzbWz9px4w.png" /><figcaption>Our security assessment table. * means that the severity depends on whether an advertised mechanism can be circumvented. Please note that additional factors influence the severity evaluation of a particular vulnerability.</figcaption></figure><p>Let us know what you think about this framework. We expect this framework to evolve over time and hope it helps drive the conversation forward about hardware wallet security.</p><h3>Acknowledgments</h3><p>I want to thank Jad Zeidan for developing and maintaining our original scoring system, and Sebastian Küng and Douglas Bakkum for giving valuable inputs to this blog post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c85a0c648283" width="1" height="1" alt=""><hr><p><a href="https://medium.com/shiftcrypto/how-we-do-security-assessments-at-shift-c85a0c648283">How we do security assessments at Shift</a> was originally published in <a href="https://medium.com/shiftcrypto">ShiftCrypto</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>