Extracting Qualcomm's KeyMaster Keys – Breaking Android Full Disk Encryption
bits-please.blogspot.com
bits-please.blogspot.com
A simple, working, FDE setup would be something like LUKS running at boot:
1. Turn on phone
2. Phone loads up initial bootstrap OS
3. Phone prompts user for master key
4. Master key is used to unlock volume
5. Regular OS boot continues
If the master key has enough entropy, brute forcing it becomes impossible. The phone won't "disable" as there's no self-destructing component (i.e. "secure crypto chip") but that doesn't mean it can be cracked. Boil as many oceans as you'd like, you're not going to brute force 256 bits of entropy.The UX problem is that the master key is a PITA to enter if it's long enough to be cryptographically secure. That's what a crypto chip is supposed to solve. A limited number of attempts with a shorter passphrase.
Argh. Just give me a stinkin' smartphone that runs Linux. These are solved problems, people.
What may be protected through other means is the key used to encrypt that filesystem. The user enters a pin or a pattern to unlock said key on boot, and that key is used to initiate LUKS.
Maybe that's what they have cracked here?
So it doesn't track the latest, but it's also not "really old" in that upstream Linux still considers it a supported version.
$ uname -a
Linux localhost 3.10.73-gef93fe9 #1 SMP PREEMPT Fri May 20 20:48:13 UTC 2016 aarch64 Android
There was a technical reason for pinning it at this version (also known the "Android kernel"), but I don't remember what that specific reason was.There could still be a short pin/passphrase in addition to that. Keepass allows for something similar by having a local file + passphrase to unlock a password vault.
Backups of the QR code could be as easy as photocopying it!
That has the same issue of not being able to input it into the phone. The QR code can be easily scanned.
Sure OCR of plain text is possible but some more standardized like a QR Code would be better.
Nothing says you can't do either, or even both[1]. The idea of using a QR Code is so that mom/dad/grandpa/grandma can use a long password to unlock their phone without having to type it in.
Bonus points if the QR Code itself is in the shape of a key!
[1]: Which would be "something you have" + "something you know".
https://developer.android.com/preview/api-overview.html#jit_...
Compiled once is easier to develop, prove correct and validate functionality. Just in time offers convenience in deferring compilation, but increases storage requirements and can decrease the initial runtime performance due to compiling the code. If you have spare cores this starts to make more sense. If you have a mechanism of profiling and automatically tuning the optimization of frequently used codepaths / infrequently used ones then JIT also starts to have payoffs (this is where human hours making a smarter compiler pay off across many applications that don't warrant the human hours optimizing directly).
Not only that, but Android N will be able to boot all the way to the lock screen before asking for the password, and even support functionality like phone calls, limited notifications, or alarms (so if your phone reboots in the night you'll still get woken up in the morning).
Even if you have a strong passphrase, there's some probability of leaking some number of bits of it via side-channels every time it's entered (e.g. surveillance cameras, fingerprints on the screen, shoulder surfing, vulnerable code, TEMPEST, etc). Plus, people often keep a backup copy of their passphrases (unique, strong passphrases are hard to remember), so there's also a cumulative risk of the backup leaking over time, as well.
Long-term confidentiality is just surprisingly hard in the real world.
Most of the secutity is pretty much a UX issue. Otherwise century-old one-time pad would fit all.
So, that's where you need the secure cryptographic processor and the trusted environment, etc.
1: secure/unmodifiable cryptographic processor
2: with unremovable rate limiting
3: and exclusive access to a hardware key
4: cryptographic processor has the only function of encrypting user data based on
5: hardware key and a user supplied pin/key
Errors done by Qualcomm: Violated 3: Hardware key not exclusivly readable by cryptographic processor
Violated 5: Encryption based on derived key
Anything I overlooked?(edited: formatting)
For 99% of the users, this is complete nonsense. Why do we encrypt the phone? Are we afraid of the NSA or whatever agency cracking our phones? No! The reason most of us encrypt the phone is to prevent others from posting our pictures or reading our mail.
When somebody else finds my phone, or steals it, the four digit PIN is enough protection. Then again, I don't use a four digit PIN, but something longer, and from six or up it's really strong enough for manual unlocking.
People who have the means to read contents from the memory chips, they probably have the means to use other measures to get what they want.
Considering they just sold for scrap an entire manufacturing pipeline to do exactly that, I'd say they really don't. If they do, they're going about it in the silliest and most roundabout way.
I have known for a long time 4 digit numeric PINs are stupid. Sadly the San Bernadino case, for all the wrong reasons, taught me all the alternative auth methods are just as risky.
Should I be worried? I don't know. But as a long time Android enthusiast and power user who does not use Google Play on his phone and restrictive permission customization like XPrivacy, I am about to just give up and have a newish iPhone for secure stuff and knock around Android for the cool open source dev I aspire to with F-Droid.
For a moment I was torn between being proud in my passphrase and sad at my lack of friends.
If I need to be constantly available to my friends, "number of seconds to a text reply" is something that I need to minimize.
Longer passphrases prevent me from sending quick replies.
This confuses me because Bluetooth over the air does not strike me a secure mechanism (is it just Bluetooth; ironically scant detail unless my Google-fu is off, likely at this hour for me).
http://www.wareable.com/android-wear/android-wear-hack-alert...
And do I need yet another smart device? The mobile first movement, with shinier crap, moving away from standard protocols, leads me to believe I have been passively perpetuating the biggest wart on computer science's labors. I am kind of embarassed, a few years in and late to the party, I bought an Android phone at all.
Relying on a weak password and a "trusted computing" mechanism like this one from Qualcomm to prevent an attacker with physical access from brute forcing it is not really advisable.
Using such a mechanism at all has downsides since it means that you lose the data if the mechanism or the entire device stops working, while otherwise you could simply move the SSD/flash/storage unit to a new identical device and have it just work as long as you type the correct password.
Also, while I would agree as far as PCs are concerned, moving the eMMC to a new phone's mainboard is probably also not a likely scenario.
Data recovery is, however, which is why I don't think one-sided promotion of ubiquitous hardware-locked-FDE is a good idea --- it becomes a tradeoff between others getting access to, and you losing access to, your data. Is it more important that this data be accessible by no one but you even if it means you might also lose access to it, or that you not lose access, even if it means others can access it? Hardware-locked FDE is suited only to the former case.
Modern phones are worse. I was at a training and happened to sit with computer forensicators and they complain about the new eMMC systems. Forensics systems for mobile devices were a piece of cake prior to that.
I suspect the eMMC thing is meant to make this difficult on purpose.
So, so much for that ...
For that matter, I think what "perfect security" could be like is the world in Orwell's 1984 --- definitely not something I'd want existing either.
What I mean is that folks want to take an existing product and layer crypto atop it, when really they need to start from the crypto and built a product over it. They want to do things which are mathematically impossible (e.g. let you read data, but not let you say that data to someone else). They want to hand the crypto to a junior developer instead of someone who knows what he's doing.
Crypto's not hard to do; organisations are bad at doing crypto.
https://www.nds.rub.de/media/nds/veroeffentlichungen/2011/10...
Replace "crypto" by just about any software engineering endeavor, and what you say is still correct.
Personally, I lean towards the latter.
https://www.gnu.org/philosophy/right-to-read.en.html
People expect stuff to just turn up on Pirate bay, extraction tools etc.
So any Android phone currently on the market is basically unfixable?
The second is that allowing a firmware updates to trustzone code means that Google could push an update which allows them to retrieve keys. Such updates should only be allowed if the user accepts them. How the user is supposed to know the difference between a security fix vs. Google trying to break into their phone is the real issue.
But IOS has this same issue. If you accept a firmware update from Apple, maybe it includes a pin logger.
1. The arbitrary code-execution in TZ has already been privately disclosed and fixed.
2. As for the second issue - I would argue that it's not an issue at all. TZ should be updated (otherwise how would they fix the TZ code-exec vulnerabilities?).
However, in this case gaining code execution in the TZ kernel directly leads to the disclosure of the keys which are meant to bind the KDF to your device. This is in direct contract with Apple's KDF. The key here is that software shouldn't be trusted, by design.
3. As for the last issue, I would argue that this is just a clever form of social-engineering. After all, who's to say they didn't just swap the phone with a dummy phone to make you insert the correct password?
However, in Android's case, you wouldn't even need to cooperate. OEMs could simply flash the new TZ code, extract the KeyMaster keys, and bruteforce the key. All without having any help from you.
Could the problem be fixed if the manufacturer used TrustZone exclusively for store key/encrypt/decrypt operations, eliminating the support for DRM and Trustlets?
I would also like to have more fine grained rules on when I can unlock with a fingerprint, when pin and when I should be forced to put in the encryption password.
Additionally I would like to use U2F NFC token on my keychain as a second factor for unlock (if I have not touched the phone for X amount of time).
Are Snapdragon and Exynos architectures that alike? I mean, do you have any preliminary idea how easy it would be to apply your Snapdragon method to an Exynos SoC?
However, Exynos uses a TrustZone TEE implementation to implement the KeyMaster module, just like Qualcomm's Snapdragon. This means that unless that TEE implementation uses a hardware key which is not software accessible, the same issue would be present. Of course, reverse-engineering a new TEE implementation would take a long time... But it sounds like it could be fun.
You should be aware that people like you are unsung heroes and I'd like you to know that many of us who are busy struggling to stay afloat are feeling better knowing that people like you are doing the work you do.
Have that in mind. I wish you well.
I have set it up this way, it needed some sqlite hackery. XDA dev has appropriate infos.
Is that magic?
https://github.com/laginimaineb/android_fde_bruteforce/blob/...
the only way to fly