Breaking the Ledger Security Model
saleemrashid.com
saleemrashid.com
[0]: https://krebsonsecurity.com/2018/03/15-year-old-finds-flaw-i...
He's definitely one of my motivations to pursue blockchain/cryptography. I used to be secure (in my bubble) that I was the best at what I do (for my age) until I met Saleem.
Gratz Saleem :)
Unfortunately, the Ledger team appear to be asshats, so there's every reason to fear using them in the future, even if they've fixed this specific issue. If they're going to handle a legit issue like this (downplaying it, etc.), I'm not willing to trust them.
I'd love to see three products created:
1) Split client/server wallets (so you don't need to trust the operator or your local machine alone); some work has been done on this. Also, split PC + SGX or phone + secure element wallets. This is basically software-only in cost, but at higher security, so it would be suitable for $0+ balance accounts.
2) A low end ($20?) wallet with a cheap display and button. If you retailed them at $100 but sold them to providers at $40 they could probably give them away for a lot of accounts; basically like Yubikeys but with displays.
3) Some higher-end hardware wallets; essentially HSMs plus display/input. HSM technology basically stagnated in 1995; there's a lot of need for something better today. This could be in the $10-50k per unit range for a lot of high-value keys if actually implemented well and in a way which had no "trust us" demons. There are hundreds or thousands of potential customers, and more by the day.
The biggest important leap of faith is that the manufacturer must be able to lock themselves out of the device. This involves physical tamper resistance and people processes. And lots of key management.
A multisignature wallet with one key encrypted browser side and another in a mobile app.
https://github.com/carbonwallet/CarbonKey
The CarbonKey app is a simple PWA (Progressive Web App) so you can deploy it yourself and completely bypass the wallet owners supply chain.
> Unfortunately, the Ledger team appear to be asshats, so there's every reason to fear using them in the future, even if they've fixed this specific issue
Your first two lines completely contradict each other.
The Nano S is #3 in your list.
The Nano S isn't really an HSM-containing-wallet. It (and the Trezor) are somewhere between a smartcard containing just the keys and an HSM. There's "trusted" display and input, but not the whole wallet. The Nano S also does have an element of "trust us" vs. an easily verifiable design.
Ridiculous. Ledger, pay him the bounty that he quite clearly deserves.
https://www.ledger.fr/2018/03/20/firmware-1-4-deep-dive-secu...
> We would like to congratulate the three security researchers who found these bounties.
> Saleem Rashid – MCU fooling
> We fully appreciate their contribution, and they certainly deserve their rewards.
> We have asked each security researcher to sign our Ledger Bounty Program Reward Agreement, that you can review as part of our transparency process
> (this document doesn’t prevent the researcher to publish their own reports).
>"You have complied and will continue to comply with the responsible disclosure process described in the Ledger Bounty Program which includes your agreement (a) not to disclose the security related bug to anyone without Ledger’s prior written consent," - [0]
I'm not a lawyer so I could be reading this wrong or maybe they never intended to enforce that clause.
[0]: Ledger Bounty Program Reward Agreement https://www.ledger.fr/wp-content/uploads/2018/03/Ledger-Boun...
As a minor in the UK, he's not capable of entering into a commercial contract, so he could void the contract at any point before the age of 18. Normally when a contract is voided, the parties are returned to their prior state. But, it seems that the doctrine of restitution makes an exception for people incapable of contracting. They are not required to return benefits received under the voided contract.
I am not a lawyer, but I think he could have signed the contract, published his piece, and kept his money even if it was against the terms of the contract.
Here's the writeup, with code you can audit/try:
https://www.stavros.io/posts/perfectly-secure-bitcoin-wallet...
https://www.ledger.fr/2018/03/20/firmware-1-4-deep-dive-secu...
Sounds like it will check if it is compromised via the update.
I'd also argue that trusting your host computer is certainly better than trusting the supplier. Shifting the burden of trust from a device you don't control to one you do is at least an improvement.
Edit: BTW your method of calling MicroPython uos.urandom() to generate the seed is not necessarily safe! The MicroPython API does not guarantee the entropy always comes from a secure hardware RNG. Just "when possible". This means depending on your MicroPython version, how the framework was compiled, what exact revision of the ESP8266, entropy may or may not come from a secure hardware RNG. As a former InfoSec professional reviewing hardware/firmware/software security-related code, I often found flaws at many levels in this area.
Edit #2: In fact, after more looking into it, the current version of MicroPython relies on an undocumented register (https://web.archive.org/web/20160417080207/http://esp8266-re...) that "seems" to be a hardware RNG however it has never been determined if it is suitable to use for cryptographic purposes. It would be a lot safer to generate your seed on an offline Linux laptop booted of a Live USB or equivalent (with no storage device), using the good old cryptographically-secure getrandom(2) syscall than blindly trusting an undocumented sketchy ESP8266 register whose implementation is completely unknown. If I were you I would discard any wallet created using your ESP8266 code.
https://www.ledgerwallet.com/support/bip39-standalone.html or https://github.com/iancoleman/bip39
PS: even a 24 word checksum takes just a couple minutes
Regardless, sure, the Arduino is also a good platform to do this on. It doesn't run MicroPython, though, so I implemented my particular program on the ESP for speed/ease of development.
Anyone have any info on why FaceID works a different way? Because it needs more processing power?
In fact, FaceID solely relies on the IR camera to do its work. You can cover the front-facing (normal) camera and your iPhone would still unlock successfully. Conversely, the newly touted Animoji feature does NOT rely on the IR camera at all, as evidenced in this iPhone X review [1] at 11:40. It may be the case that the OS don't have access to it.
[0] https://images.apple.com/business/docs/iOS_Security_Guide.pd...
I can’t swear to you that this is exactly the same depth data that FaceID uses. Maybe it’s been downsampled in some way that makes it safe to give to apps, without enabling attacks on FaceID. I think I’d be a bit more willing to believe that if Apple’s Security docs actually said that. To me it seems more likely that the raw depth maps are available to the app processor (and to apps!) because the SEP isn’t powerful enough to perform the recognition task on its own.
An attacker on the supply chain can always add a part that interposes on all i/o to the secure parts. This would have the same impact, unless I'm missing something, as compromising the insecure micro. The underlying problem is that there's no cryptographically secure path between the secure element and your eyes.
Ledger's verifiable erasure scheme is pretty interesting, actually. I prototyped something similar and ultimately abandoned it due to the high complexity and bandwidth requirements. From the sounds of it the major differences were that ledger didn't attempt to wipe and then reinitialize, but instead just tried to verify know state. Might still be made to work by changing that, although good luck over a uart.
It also seems like they finally accepted OP's bug report as part of their bounty program.
[0]: https://www.ledger.fr/2018/03/20/firmware-1-4-deep-dive-secu...
When creating the Mooltipass offline password keeper we actually spent a considerable amount of time thinking about solutions for the particular problem explained on this website.
We therefore opted for the following techniques:
- only allow signed firmware updates, signed using an encryption key unique to each device
- given that firmware flashing using external programmers requires complete flash/eeprom erase, we implemented a challenge/response protocol to check for tampering during shipping.
Obviously things are way easier when you don't allow custom firmwares to be flashed on a device. But as a general rule I wouldn't trust a device that would allow other programs to run on it (eg phones, computers...)
You can see that in the author's section of his dealing with Ledger, and if you go to /r/ledgerwallet subrredit you'll be able to see their interaction rubs off as quite a bit condescending to downright insulting[0] considering people have lost money over some issues, shrugging it off as "it's your fault".
[0] https://www.reddit.com/r/ledgerwallet/comments/7tvyar/psa_do...
[0] https://www.ledger.fr/2018/03/20/firmware-1-4-deep-dive-secu...
Haven't played with the newer Model-T with a touchscreen, I'm talking about the original Trezor which I believe they have no plans to EOL.
https://medium.com/@Zero404Cool/trezor-security-glitches-rev...
Which to my untrained eye looks more severe.
https://blog.trezor.io/trezor-firmware-security-update-1-5-2...
Not to mention that they're hard to generate securely.
Edit: I mean: if it's possible for the manufacturer to compromise their customers, then in the case of crypto wallets, you have to assume that they will screw their customers over. The potential profits for a company like Ledger, running a long scam, waiting for the moment their take hits a high enough sum to be worth doing a runner and relocating to some island paradise under a fake name, are just too great to allow for trust.
Until now, I assumed the whole point of HW wallets was a 100% assurance of trustlessness. Now, it seems maybe that isn't the case.
No, you don't. That's, like, the exact opposite of the whole model of cryptocurrency, which is trusting an anonymous collection of people.
I'm actively seeking help in porting a wallet app to the hardware. I am willing to pay to get this done.
I can't watch the video (says unsupported mime type on my browser), but I heard the attack goes something like this: intercept the wallet, set up the wallet and copy the seed, repackage it, hope the victim uses the wallet as-is (with the seed you copied). Can't this be mitigated by resetting the device when you first get it?
>2 variants of "firmware reflash"
I thought firmware updates are signed?
edit: disregard the second point. further down it mentions that only SE firmware is signed
>Evil Maid attack
Is it even possible to mitigate this? At the very least you can steal the original, replace it with a replica that looks the same, BUT all it does is send back the password to you (via bluetooth, wifi, gsm, whatever). You can even hook up the stolen wallet on the other end so it correctly respond whether the password is correct/wrong and immediately drain the wallet once the correct password is transmitted.
No, he demonstrates a device going through setup and "generating" a predetermined seed. It's not the easier "your wallet has already been set up for you" attack.