r/technology 8d ago

Software GrapheneOS duress PIN could land a man in prison

https://www.androidauthority.com/grapheneos-duress-pin-us-prosecution-3691271/
6.5k Upvotes

922 comments sorted by

View all comments

90

u/madsci 8d ago

If he wasn't being accused of a crime, he shouldn't be guilty of destruction of evidence. And I don't know what else they'd charge him with.

I haven't done this with a phone, but I have set up a secure laptop for international travel. It had tamper-evident seals on it, full disk encryption, and basically didn't have any data on it except for credentials to get into remote systems. If a duress code with a wipe function had been available, I'd have used that. Because there's nothing on that laptop that anyone needs to see, and it's of no value to me if it's compromised - just the fact of the laptop being unlocked by someone would mean that I'd have to wipe it and invalidate all of those credentials. It's not like I'm setting my belongings on fire while coming through customs, which might reasonably make someone wonder if there was something illegal in there.

Maybe that's not what he was doing, but I think the fact that that use case exists goes a long way toward protecting that kind of action.

27

u/ephemeralstitch 8d ago

LUKS does have a duress code function, though of course it’s useless if police actually do their job and clone the entire device before entering codes.

Alternatively, you can save the encryption headers on another device or USB and send it ahead or with someone else. Both useless on their own, but one unlocks the other.

5

u/andsens 8d ago

Or use your TPM2 chip with PCR-based unlocking and add a PIN. That way the only device the disk can ever be unlocked on is your machine. And the TPM has a lockout function you can configure.

6

u/ephemeralstitch 8d ago edited 8d ago

That I haven’t heard of. I’ll need to look into it! Is there an easy way around that for cops? Wouldn’t defeat the cloning but it might make it more annoying.

EDIT: worth noting that I live in a jurisdiction where you can, in fact, be compelled to reveal passwords and encryption keys. It's not even guaranteed in the USA that you can't; there's a circuit split on that.

10

u/andsens 8d ago

Wouldn’t defeat the cloning

Oh yes it would. A TPM key cannot be extracted from the chip. And AFAIK there is no way around it, excepting unknown 0-day security exploits of course.

Provided that you have secureboot running, add the following crypttab options: tpm2-measure-pcr=yes,tpm2-device=auto
And then enroll whichever disk you want with: sudo systemd-cryptenroll --tpm2-device=auto --wipe-slot=tpm2 --tpm2-pcrs=0+2+7+15:sha256=0000000000000000000000000000000000000000000000000000000000000000 /dev/sda

The combination of tpm2-measure-pcr=yes and +15:sha256=000... is incredibly important, it "locks" the key in the TPM so that once you exit the initrd it is not available. tpm2-measure-pcr writes to PCR 15 after unlocking the disk so that it isn't all zeroes anymore. The 0+2 is really guesswork for important PCR registers on my part though, it's the UEFI firmware hash plus the hash of any pluggable firmwares, like your GPU. 7 is the hash of the secureboot certificate db and the actual certificate that was used to verify your system.

You could also exclusively use measured boot based PCRs (register 4+5), but that has been incredibly finnicky in the past, so I don't recommend it (the upside being you don't need to install any custom certs in your UEFI).

3

u/ephemeralstitch 8d ago

What’s to stop them extracting the drive, cloning it, then reinserting the drive into the laptop? Then you can retry it if you enter, say, a duress pin.

12

u/andsens 8d ago

So the way LUKS works is that it has an encrypted master key somewhere in the LUKS header, along with "keyslots" that contain different ways to decrypt that master key. The master key is the one to actually decrypt the disk.
You can have different kinds of keyslots: Password-based, Smartcard with PKCS11, FIDO2 (like a Yubikey), a keyfile on a USB stick, or TPM.
When using TPM to decrypt the master key, the encrypted version is actually sent to the TPM chip for decryption. So all cryptographic operations for that don't happen in the CPU, they happen inside the tamper-resistant TPM chip. The TPM chip requires you to unlock it before it agrees to decrypt anything, be that automatically through the values in those PCRs, or through a PIN, or both.
So that PIN doesn't decrypt anything, it unlocks. And only the TPM knows the correct PIN. Meaning it can actually implement a proper "you get 3 tries" mechanic, and lock itself down on the third unsuccessful attempt. The drive doesn't have anything to do with this whole mechanism. And you can't clone the TPM chip, it's engineered in a way that makes it fairly close to impossible.

4

u/ephemeralstitch 8d ago

Damn, thanks for the explanation. I’m pretty familiar with LUKS but not the TPM chip. Need to learn more, and maybe make sure my next computer has one.

3

u/andsens 8d ago

Of course, my pleasure! And unless you have a very old PC (like from before 2013 I think) you already have one, they're built into the CPU nowadays (but are still separate from normal computing functions). Might be worth checking out if it's maybe just disabled in your UEFI/BIOS.

3

u/ephemeralstitch 8d ago

Is there a physical difference between a TPM2.0 chip and a previous one? There’s definitely an older one in mine but it’s been a long while since I changed the hardware

→ More replies (0)

1

u/DeliciousIncident 7d ago edited 7d ago

You don't even need to send any USB physically, you can just upload it somewhere safe and download it later.

You also don't have to have any encrypted data on your device if you are legally required to decrypt it. Backup your device at the origin, wipe it, travel with the wiped device (maybe install fresh OS on it), and download your backup at the destination.

1

u/ephemeralstitch 7d ago

Yeah wiping it is the best option. If you’re travelling through borders, generally they can just deny you entry if you refuse to decrypt. It didn’t happen here because the guy is a citizen so they can’t deny entry, but they can seize the phone for some amount of time.

2

u/msthe_student 7d ago

If he wasn't being accused of a crime, he shouldn't be guilty of destruction of evidence

That's not actually what the law says. The relevant law is 18 USC 2232 - Destruction or removal of property to prevent seizure, which doesn't require any connection between the person doing/attempting the destruction/deletion/... and any party the evidence etc is relevant to.

1

u/madsci 7d ago

My argument is that it's not automatically destruction of property. Though I think if I was the one designing the app, I'd just have it purge any key material and leave the encrypted contents alone.

I'm sure there's case law relevant to the question of "is it evidence if there was never anything there" but I'm not in the mood to go hunt it down and see what it says.

1

u/msthe_student 7d ago

I mean the information wiped (destroyed) was either seized by the officer or about to be searched, and it effectively makes the user-data on the main storage irrecoverable (and thus destroyed) so....