{"id":15154,"date":"2019-01-10T07:56:02","date_gmt":"2019-01-10T12:56:02","guid":{"rendered":"https:\/\/www.kaspersky.co.uk\/blog\/?p=15154"},"modified":"2020-12-11T15:29:17","modified_gmt":"2020-12-11T15:29:17","slug":"hardware-wallets-hacked","status":"publish","type":"post","link":"https:\/\/www.kaspersky.co.uk\/blog\/hardware-wallets-hacked\/15154\/","title":{"rendered":"How to hack a hardware cryptocurrency wallet"},"content":{"rendered":"<p>Hardware wallets are considered to be the most secure type of cryptocurrency wallet. However, nothing is 100% secure, and they can be compromised just as well. At the 35th Chaos Communication Congress, security researchers Thomas Roth, Dmitry Nedospasov, and Josh Datko demonstrated several ways to do it. But before we jump into hacking, a little background on what a hardware wallet actually is and how it works.<\/p>\n<h2>What is a cryptocurrency wallet?<\/h2>\n<p>First of all, let\u2019s talk a bit about what a cryptocurrency wallet is in general. To put it simply, a wallet is a cryptocurrency account. The \u201caccount\u201d consists of <a target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Public-key_cryptography\" rel=\"noopener noreferrer nofollow\">a pair of cryptographic keys<\/a>, one public and one private. These two keys have some resemblance to login and password pairs: The public key is used as a wallet address, and the private key is used to access coins \u2014 that is, to sign outgoing transactions.<\/p>\n<p>Another thing worth mentioning is how multiple public\u2013private key pairs are generated in cryptocurrency systems for multiple wallets belonging to the same person. It might be inconvenient to store several completely independently generated key pairs. So what cryptocurrency systems really do is generate just one big number called a cryptographic seed and derive multiple public\u2013private key pairs from the seed in a predictable manner for multiple wallets.<\/p>\n<p>This one big number \u2014 the cryptographic seed \u2014 is what a user of a cryptocurrency system actually stores.<\/p>\n<p>Unlike traditional financial systems, cryptocurrencies usually have no centralized authority, no registration mechanisms, nothing like chargeback insurance, and no account recovery options. Anyone who owns the cryptographic seed and therefore the keys derived from it, owns the corresponding cryptocurrency wallets. And if the seed is stolen or lost, so are the coins in the wallets.<\/p>\n<p>By the way, formally a wallet is a pair of public\u2013private keys. However, most of the time <em><em>means of storing those keys<\/em><\/em> are also referred to as <em><em>wallets<\/em><\/em>. If you put it this way, a hardware wallet is a device that stores cryptocurrency wallets. Easy, right?<\/p>\n<h3>Why would anyone need a hardware cryptocurrency wallet?<\/h3>\n<p>As you can imagine, it\u2019s a good idea to keep this Very Important Seed as safe as possible. There are plenty of ways to store the seed, <a target=\"_blank\" href=\"https:\/\/www.kaspersky.com\/blog\/cryptowallets\/22025\/\" rel=\"noopener noreferrer nofollow\">each with pros and cons<\/a>. The most convenient method is storing the seed either in your computer or smartphone, or, even handier, online. However, malware hunting for cryptocurrency wallets is not uncommon at all. As for the online wallet services, they <a target=\"_blank\" href=\"https:\/\/www.kaspersky.com\/blog\/lazarus-crypto-exchange-attack\/23610\/\" rel=\"noopener noreferrer nofollow\">can be hacked<\/a> and even <a target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Mt._Gox\" rel=\"noopener noreferrer nofollow\">go bankrupt, with large amounts of coins disappearing<\/a>.<\/p>\n<p>On top of that, <a target=\"_blank\" href=\"https:\/\/www.kaspersky.com\/blog\/cryptocurrencies-intended-risks\/20034\/\" rel=\"noopener noreferrer nofollow\">further problems<\/a> plague wallets, including phishing, payment information spoofing, loss of wallets due to hardware failure, and so on and so forth \u2014 so much so that at some point people decided to solve the mess by making hardware cryptocurrency wallets, dedicated devices designed to store cryptographic seeds reliably and safely.<\/p>\n<h3>How hardware cryptocurrency wallets work<\/h3>\n<p>The main idea behind a hardware cryptocurrency wallet is to store the cryptographic seed in a manner that it never leaves the device. All the cryptosigning stuff is done inside the wallet, not on a computer that it is connected to. Therefore even if your computer gets compromised, the invaders won\u2019t be able to steal your keys.<a target=\"_blank\" href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10124945\/hardware-wallets-hacked-idea.jpg\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15157\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10124945\/hardware-wallets-hacked-idea.jpg\" alt=\"Why would anyone need a hardware cryptocurrency wallet\" width=\"1460\" height=\"820\"><\/a><\/p>\n<p>In addition it would be nice to have some access-protection measures \u2014 like locking the device with a PIN code. And of course it would be quite useful for a hardware wallet user to be able to verify the actual transaction <em><em>on the device<\/em><\/em> and to either confirm or deny it.<\/p>\n<p>All these considerations define the most suitable design: Usually a hardware cryptocurrency wallet is a relatively small USB-connected dongle that has a display and some buttons that are used for PIN entering and transaction confirmation.<\/p>\n<p>However, the inner workings of such devices can vary. The two leading manufacturers of hardware wallets \u2014 Trezor and Ledger \u2014 represent two different approaches to the hardware design.<\/p>\n<h4>Ledger\u2019s approach: The cryptographic seed is stored in the Secure Element chip<\/h4>\n<p><\/p>\n<p>Ledger\u2019s devices \u2014 namely Ledger Nano S and Ledger Blue \u2014 have two main chips. One is <a target=\"_blank\" href=\"https:\/\/www.kaspersky.com\/blog\/secure-element\/22408\/\" rel=\"noopener noreferrer nofollow\">Secure Element<\/a>, a microcontroller designed to store highly sensitive cryptographic data. More specifically, these chips are used in SIM cards, in chip-and-PIN banking cards, and in Samsung Pay\u2013 and Apple Pay\u2013 compatible smartphones.<\/p>\n<p>The second chip is a general purpose microcontroller that handles peripheral tasks: maintaining USB connection, controlling display and buttons, and so on. In effect, this microcontroller acts like a middleman between the Secure Element and everything else, including the user. For example, every time the user has to confirm a transaction, they are actually going through this general purpose microcontroller, not the Secure Element chip.<a target=\"_blank\" href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10124954\/hardware-wallets-hacked-ledger-security-model.jpg\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15159\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10124954\/hardware-wallets-hacked-ledger-security-model.jpg\" alt=\"The Ledger Nano S security model\" width=\"1460\" height=\"820\"><\/a><\/p>\n<p>However, even storing cryptographic seeds in a protected chip doesn\u2019t make Ledger\u2019s device entirely impenetrable. For one thing, although it is very hard to hack into a Secure Element directly and steal a cryptographic seed, it\u2019s relatively easy to compromise a general purpose microcontroller and thereby deceive a hardware wallet to confirm an outsider\u2019s transactions.<\/p>\n<p>Researchers inspected the Ledger Nano S firmware and found that it can be re-flashed with a compromised version if a certain value is written to a certain memory address. This memory address is blocked to make it unwritable. However, the microcontroller that is used in the device supports memory remapping, which changes the address to accessible. Researchers exploited this feature and uploaded modified firmware into the Nano S. For demonstration purposes, this modified firmware contained a Snake game. However, this modified firmware could contain, for example, a malicious module that changes wallet addresses in all outgoing transactions.<\/p>\n<p>An alternative approach to compromise a hardware wallet is to use a hardware implant. Josh Datko managed to insert into a Ledger Nano S a cheap RF-triggered implant that pushes the confirmation button upon receiving a malicious radio command. The same method probably works with any hardware wallet; the researcher chose Ledger Nano S because it is one of the smallest, and therefore the most challenging for this physical attack.<\/p>\n<p>Another device by the same manufacturer, the Ledger Blue, turned out to be vulnerable to side-channel attacks. Ledger Blue is a hardware wallet with a really large display and a big battery. It has a circuit board design flaw that leaks pretty distinguishable RF signals when the user is entering a PIN code. Researchers recorded the signals and trained a machine-learning algorithm to recognize them with 90% accuracy.<a target=\"_blank\" href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125001\/hardware-wallets-hacked-buzzword-bingo.jpg\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15161\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125001\/hardware-wallets-hacked-buzzword-bingo.jpg\" alt=\"Hacking a blockchain IoT device with AI in the cloud\" width=\"1460\" height=\"820\"><\/a><\/p>\n<h4>Trezor\u2019s approach: The cryptographic seed is stored in the general-purpose microcontroller\u2019s flash memory<\/h4>\n<p><\/p>\n<p>Trezor\u2019s devices work a bit differently. They don\u2019t use a Secure Element, so everything in the device is controlled by a single chip, a general purpose microcontroller based on ARM architecture. This chip is responsible both for cryptographic data storage and processing, and for managing the USB connection, display, buttons, and so on.<\/p>\n<p>Theoretically this design approach could make it easier to hack the device\u2019s firmware and thus get access to the cryptographic seed stored in the microcontroller\u2019s flash memory. However, as the researchers said, Trezor did a really good job with hardening the firmware, so researchers had to go for hardware hacking, where they found success.<a target=\"_blank\" href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125009\/hardware-wallets-hacked-trezor-security-model.jpg\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15163\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125009\/hardware-wallets-hacked-trezor-security-model.jpg\" alt=\"Trezor One security model\" width=\"1460\" height=\"820\"><\/a><\/p>\n<p>Using a hacking technique called <em><em>voltage glitching<\/em><\/em> (applying lowered voltage to a microcontroller, which causes funny effects in the chip) they switched Trezor One\u2019s chip state from \u201cno access\u201d to \u201cpartial access,\u201d which allowed them to read the chip\u2019s RAM, but not the flash storage. After that they found out that when the firmware upgrade process is started, the chip places the cryptographic seed into RAM to retain it while the flash is being overwritten. In this manner, they managed to get all memory contents. Finding the cryptographic seed in this dump turned out to be no problem; it was stored in RAM unencrypted, in the form of a <a target=\"_blank\" href=\"https:\/\/en.bitcoin.it\/wiki\/Seed_phrase\" rel=\"noopener noreferrer nofollow\">mnemonic phrase<\/a> (meaning actual words instead of random number) that was easy to spot.<\/p>\n<div id=\"attachment_25320\" style=\"width: 1470px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125016\/hardware-wallets-hacked-trezor-pwned.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-25320\" src=\"https:\/\/media.kasperskydaily.com\/wp-content\/uploads\/sites\/86\/2019\/01\/10125016\/hardware-wallets-hacked-trezor-pwned.jpg\" alt=\"Trezor One compromised with a voltage glitch; cryptographic seed and PIN stolen\" width=\"1460\" height=\"820\" class=\"size-full wp-image-15165\"><\/a><p id=\"caption-attachment-25320\" class=\"wp-caption-text\">The memory dump contains the cryptographic seed in the form of mnemonic phrase and PIN (in this case, it\u2019s 1234), stored in plain text<\/p><\/div>\n<h3>Conclusions<\/h3>\n<p>I have to mention here that most of the hacks described by Thomas Roth, Dmitry Nedospasov, and Josh Datko are quite sophisticated \u2014 and they require physical access to the device. So don\u2019t rush to throw your Ledger or Trezor into a trash bin. As long as no one has access to it, your bitcoins should be fine (though somewhat depreciated).<\/p>\n<p>Nevertheless, it\u2019s a good idea to keep in mind the existence of supply chain attacks. Hardware wallets are relatively easily tampered with and can be compromised even prior to purchase. Of course, the same goes for regular laptops or smartphones. However, attackers can\u2019t be sure if a particular laptop will be used for cryptocurrency storage. Hardware wallets, in this context, are a sure thing.<\/p>\n<p>Manufacturers of hardware wallets are trying to address the problem, for example by using security stickers on devices\u2019 packages and creating pages on their websites that allow customers to perform online security checks of their wallets. However, these measures may not be helpful enough, and they can even be confusing.<\/p>\n<p>Anyway, unlike <a target=\"_blank\" href=\"https:\/\/www.theregister.co.uk\/2018\/08\/31\/bitfi_reluctantly_drops_unhackable_claim\/\" rel=\"noopener noreferrer nofollow\">some other hardware wallets<\/a>, Ledger\u2019s and Trezor\u2019s devices are designed with security in mind. Just don\u2019t assume that they are 100% unhackable. Take a few additional steps to protect your cryptofortune:<\/p>\n<ul>\n<li>Buy hardware cryptocurrency wallets only from trusted vendors.<\/li>\n<li>When buying, check thoroughly for any signs of tampering.<\/li>\n<li>To be more certain pop the device open and make sure no extra elements are attached to the circuit board.<\/li>\n<li>Store your cryptowallet in a safe place, and don\u2019t allow people you don\u2019t trust to get their hands on it.<\/li>\n<li>Protect the computer you use for cryptocurrency with <a href=\"https:\/\/www.kaspersky.co.uk\/premium?icid=gb_bb2022-kdplacehd_acq_ona_smm__onl_b2c_kdaily_lnk_sm-team___kprem___\" target=\"_blank\" rel=\"noopener\">reliable security software<\/a>. A good part of the hacks described above require malware to be installed on the computer the hardware wallet is connected to.<\/li>\n<\/ul>\n<p>Extra Trezor tips:<\/p>\n<ul>\n<li>Trezor is an open-source platform, both software and hardware. So if you are skilled enough with electronics, you can build your own hardware wallet using off-the-shelf components. This way you can be 100% sure nobody has messed with the hardware part of your wallet.<\/li>\n<li>Trezor devices provide extra protection with a passphrase to protect from seed extraction hacks (the idea of this mode is that the <a target=\"_blank\" href=\"https:\/\/wiki.trezor.io\/Passphrase\" rel=\"noopener noreferrer nofollow\">stored seed is incomplete without the passphrase<\/a>). Consider using this mode.<\/li>\n<\/ul>\n<p>Here\u2019s the original talk. Have a look \u2014 it\u2019s both entertaining and helpful for hardware wallets users.<\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe class=\"youtube-player\" type=\"text\/html\" width=\"640\" height=\"390\" src=\"https:\/\/www.youtube.com\/embed\/Y1OBIGslgGM?version=3&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent\" frameborder=\"0\" allowfullscreen=\"true\"><\/iframe><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Security researchers found several ways to compromise hardware cryptocurrency wallets made by Ledger and Trezor.<\/p>\n","protected":false},"author":421,"featured_media":15155,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1623,2026],"tags":[2432,374,2090,2091,1922,2207,2437],"class_list":{"0":"post-15154","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-technology","8":"category-threats","9":"tag-35c3","10":"tag-bitcoin","11":"tag-ccc","12":"tag-chaos-communication-congress","13":"tag-cryptocurrencies","14":"tag-cryptowallet","15":"tag-hardware-wallets"},"hreflang":[{"hreflang":"en-gb","url":"https:\/\/www.kaspersky.co.uk\/blog\/hardware-wallets-hacked\/15154\/"},{"hreflang":"en-in","url":"https:\/\/www.kaspersky.co.in\/blog\/hardware-wallets-hacked\/15027\/"},{"hreflang":"en-ae","url":"https:\/\/me-en.kaspersky.com\/blog\/hardware-wallets-hacked\/12609\/"},{"hreflang":"en-us","url":"https:\/\/usa.kaspersky.com\/blog\/hardware-wallets-hacked\/16959\/"},{"hreflang":"es","url":"https:\/\/www.kaspersky.es\/blog\/hardware-wallets-hacked\/17653\/"},{"hreflang":"it","url":"https:\/\/www.kaspersky.it\/blog\/hardware-wallets-hacked\/16785\/"},{"hreflang":"ru","url":"https:\/\/www.kaspersky.ru\/blog\/hardware-wallets-hacked\/22183\/"},{"hreflang":"x-default","url":"https:\/\/www.kaspersky.com\/blog\/hardware-wallets-hacked\/25315\/"},{"hreflang":"fr","url":"https:\/\/www.kaspersky.fr\/blog\/hardware-wallets-hacked\/11323\/"},{"hreflang":"pt-br","url":"https:\/\/www.kaspersky.com.br\/blog\/hardware-wallets-hacked\/11311\/"},{"hreflang":"pl","url":"https:\/\/plblog.kaspersky.com\/hardware-wallets-hacked\/10239\/"},{"hreflang":"de","url":"https:\/\/www.kaspersky.de\/blog\/hardware-wallets-hacked\/18362\/"},{"hreflang":"ja","url":"https:\/\/blog.kaspersky.co.jp\/hardware-wallets-hacked\/22245\/"},{"hreflang":"nl","url":"https:\/\/www.kaspersky.nl\/blog\/hardware-wallets-hacked\/23677\/"},{"hreflang":"ru-kz","url":"https:\/\/blog.kaspersky.kz\/hardware-wallets-hacked\/17876\/"},{"hreflang":"en-au","url":"https:\/\/www.kaspersky.com.au\/blog\/hardware-wallets-hacked\/21913\/"},{"hreflang":"en-za","url":"https:\/\/www.kaspersky.co.za\/blog\/hardware-wallets-hacked\/21859\/"}],"acf":[],"banners":"","maintag":{"url":"https:\/\/www.kaspersky.co.uk\/blog\/tag\/35c3\/","name":"35c3"},"_links":{"self":[{"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/posts\/15154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/users\/421"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=15154"}],"version-history":[{"count":13,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/posts\/15154\/revisions"}],"predecessor-version":[{"id":21982,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/posts\/15154\/revisions\/21982"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/media\/15155"}],"wp:attachment":[{"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=15154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=15154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaspersky.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=15154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}