Skip to contentSkip to conversation

A _good_ and valid use for TPM

DISCUSSION Alex Besogonov 6 participants 12 messages Feb 18, 2009 – Feb 21, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

I know that TPM has been mentioned several times on this list. With absolutely inadequate knee-jerk reactions from GRUB developers :(

Currently I have a problem - I need to protect confidential private data (we try to protect privacy of our customers) from the _physical_ theft of the server. A simple full hard drive encryption should work just fine except for one small detail - there's nobody to enter the password when server reboots.

I've solved this by adding an intermediate system which connects to another server (which I consider physically secure), retrieves decryption key and does kexec into the real OS passing this key as a parameter. So I can just delete the key from the secure server to stop the physically insecure sever from booting, it'll then be useless for attackers since there's no decryption key present on it.

However, it would be fairly trivial for attacker to steal the server and/or make a full copy of its hard drive and then modify intermediate system to print the decryption key. Not good. And there's no way to solve it in software, since attacker can trivially change the bootloader.

So I've added another layer of security - I use TPM to remotely attest that the bootloader and the intermediate system is not modified. It requires chain of trust from BIOS to the intermediate system. So if attacker tries to modify bootloader or intermediate system image - TPM will not provide keys for communication with the secure server.

Please note, that if TPM chip is blocked/kicked/de-soldered/sacrificed to GNU gods then I can still retrieve all data because the main decryption key is NOT kept in the TPM module (TPM is only used to attest integrity of the system). Also, this is not a DRM scheme.

So... Why not add TPM patches into the mainline GRUB2 project? GPLv3 protects nicely against the possible DRM misuse of GRUB2 and TPM. Also I can assist in forward-porting of 'Trusted GRUB' patch.

#1 lore raw

I don't know much about TPM but from example that I read at TreacherousGrub website actual verification is done by TreachorousGrub. I don't see how such a verification can protect against anything.
If you suppose that your attacker is unable to tamper the hardware then bios and grub password is all you need. If you suppose that he can then you can't even trust your ram modules. It can be tampered in many ways like serving hacked bootloader or just being non-volatile then an attacker can read the key from memory. FSF acknowledges that treacherouscomputing may offer minor advantages but dissmisses the technology as whole and I agree with them.
However, I'm neither a grub maintainer nor fsf representative.
Regards
Vladimir 'phcoder' Serbinenko

Quoted 42 lines · Alex Besogonov

I know that TPM has been mentioned several times on this list. With absolutely inadequate knee-jerk reactions from GRUB developers :(

Currently I have a problem - I need to protect confidential private data (we try to protect privacy of our customers) from the _physical_ theft of the server. A simple full hard drive encryption should work just fine except for one small detail - there's nobody to enter the password when server reboots.

I've solved this by adding an intermediate system which connects to another server (which I consider physically secure), retrieves decryption key and does kexec into the real OS passing this key as a parameter. So I can just delete the key from the secure server to stop the physically insecure sever from booting, it'll then be useless for attackers since there's no decryption key present on it.

However, it would be fairly trivial for attacker to steal the server and/or make a full copy of its hard drive and then modify intermediate system to print the decryption key. Not good. And there's no way to solve it in software, since attacker can trivially change the bootloader.

So I've added another layer of security - I use TPM to remotely attest that the bootloader and the intermediate system is not modified. It requires chain of trust from BIOS to the intermediate system. So if attacker tries to modify bootloader or intermediate system image - TPM will not provide keys for communication with the secure server.

Please note, that if TPM chip is blocked/kicked/de-soldered/sacrificed to GNU gods then I can still retrieve all data because the main decryption key is NOT kept in the TPM module (TPM is only used to attest integrity of the system). Also, this is not a DRM scheme.

So... Why not add TPM patches into the mainline GRUB2 project? GPLv3 protects nicely against the possible DRM misuse of GRUB2 and TPM. Also I can assist in forward-porting of 'Trusted GRUB' patch.

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 4 lines · Jan Alsenz

I've recently started porting TrustedGRUB (
http://sourceforge.net/projects/trustedgrub ) to GRUB2.
I didn't get too far as I don't have too much time right now, but I managed to complete the MBR bootloader.

Great! MBR is the most scary part :)

Quoted 4 lines

I agree with you on the usefulness of a TPM for disk encryption and have a similar scheme planned.
Regardless of the outcome of the discussion on the mailing list I would be interested in a "trusted" GRUB2 version. Maybe we could join forces?

Absolutely. I just hate doing work that won't appear in the mainline version :(

Quoted 5 lines

BTW, the "manufacturer key" everyone is talking about is usually referred to as "endorsement key", which is generated during production (and whose private part is considered possibly in the possession of the manufacturer). I heard, that some newer TPM versions support reinitializing this key, but I'm not sure of that.

Uhm... TPM_CreateEndorsementKeyPair can be used to create the endorsement key pair, and the spec also says that TPM chip _must_ ship with empty endorsement key. It also can later be changed.

Quoted 2 lines

And you do loose the ability to do remote attestation with "official" entities, if you do it.

Well, I don't care about that. And in any case, no-one uses TPM for 'official' purposes.

#4 lore raw

First of all your system is still totally vulnerable to emanation and power analysis or hw tampering. By reflashing bios one can bypass all tpm protections (don't say it's difficult because it's closed source and so on. Look at all closed source obfuscations/pseudo-protections that get cracked every day)
Personally if tpm support is merged into mainline grub2 I'll stop using it. However what you request doesn't need tpm. Authenticity of modules, configuration files and so on can be verified by one of 4 methods:
1) internal signatures
2) file in signed gpg container
3) detached signatures
4) signed hash file
First three goals can be achieved by adding a layer similar to gzio
behaviour of checking can be controlled by environment variables and flags passed to
grub_signed_file_open (filename, flags);
First advantage is that you can override it manually supplying grub password
When signature module isn't loaded then this function is available as a dummy (all files are unsigned/wrong signature).
Public key can be embedded in signature module. When loaded signature module sets strict signing policy which can be then overriden by variable (to set such a variable you need either password or a command in signed grub.cfg)
Then these modules can be embedded in core.img. In this case if core.img is untampered everything is verified. Ensuring integrity of core.img is platform-dependent. Some platforms (openfirmware, efi, ...) load core.img directly and if they have an ability to check the boot image it's straightforward. I haven't thought yet how to do it in limited space of mbr. In coreboot scenario it's even the best bet. You can put grub2 in rom and if you use rom instead of flashrom it's a wonderful solution. But even if you use flash rom your security is similar to scenario you propose since as I said at the begining modyfiing flash bios you can bypass tpm scenario Advantage of this approach is the ability to safely update over network
Forth goal can be achieved with usage of first part and function similar to sha1sum or whirlpoolsum (my prefered hash)
Another idea: for some partitions (e.g. system partitions) signatures or mac can be much better. btrfs supports checksumming of data and metadata. Add mac support is easy. Signatures are more delicate I'm looking for compact and fast signatures.
I personally would be interested in implementing security features in grub2 as long as tpm stays away

Regards
Vladimir 'phcoder' Serbinenko

Quoted 32 lines · Alex Besogonov
Quoted 4 lines · Jan Alsenz

I've recently started porting TrustedGRUB (
http://sourceforge.net/projects/trustedgrub ) to GRUB2.
I didn't get too far as I don't have too much time right now, but I managed to complete the MBR bootloader.

Great! MBR is the most scary part :)

Quoted 4 lines

I agree with you on the usefulness of a TPM for disk encryption and have a similar scheme planned.
Regardless of the outcome of the discussion on the mailing list I would be interested in a "trusted" GRUB2 version. Maybe we could join forces?

Absolutely. I just hate doing work that won't appear in the mainline version :(

Quoted 5 lines

BTW, the "manufacturer key" everyone is talking about is usually referred to as "endorsement key", which is generated during production (and whose private part is considered possibly in the possession of the manufacturer). I heard, that some newer TPM versions support reinitializing this key, but I'm not sure of that.

Uhm... TPM_CreateEndorsementKeyPair can be used to create the endorsement key pair, and the spec also says that TPM chip _must_ ship with empty endorsement key. It also can later be changed.

Quoted 2 lines

And you do loose the ability to do remote attestation with "official" entities, if you do it.

Well, I don't care about that. And in any case, no-one uses TPM for 'official' purposes.

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw
Quoted 7 lines · On Thu, 19 Feb 2009 16:05:10 +0100 phcoder <[email protected]> wrote:

Personally if tpm support is merged into mainline grub2 I'll stop using it. However what you request doesn't need tpm. Authenticity of modules, configuration files and so on can be verified by one of 4 methods:
1) internal signatures
2) file in signed gpg container
3) detached signatures
4) signed hash file

While TPM may open a door for corporations to prevent machine owners from having control over their machines, in this instance I do not see another way to solve Alex's problem.

To restate the problem:

1. The disk must be encrypted.
2. The system must be able to boot without human interaction. That is, a user cannot be prompted for a passphrase or key.

The solution using TPM, as I understand it, essentially puts the encryption key into tamper-resistant memory in the TPM module, and supports integrity verification of the system, including the software on the hard disk, at load time.

It sounds like any solution to problem points (1) and (2) would require some sort of tamper-resistant module to store the key and handle the first level of verification (to verify the initial code loaded from disk). From that point on, the verified boot sector code can read the encryption key and verify the next-higher level of software, and so on.

The evil part of TPM seems to be when a person buys a computer but the computer is locked down with a key not provided to the buyer.

Regards,
Colin

#6 lore raw

As I understand from his letters and from a quick look at tgrub all he needs is to ensure the chain of verification. It seems that tgrub never reads tpm key. Even if we one finds tpm acceptable way to check OS integrity I don't see why we would rely on it if more universal approach is possible I outlined how it can be checked that if core.img is untampered then OS isn't tampered with. I also think I might have a way to extend this chain back to mbr by using following ideas:
1) padding in sha1 isn't necessarry in this case since we always load fixed amount of sectors.
2) BPB blocks can be reclaimed. If grub boot is in partition then mbr may haven't checked it
3) only one read is necessary in first sector. All real reading function can be moved to loaded sector. So only sha1 implementation is really needed to be done in mbr.
4) I find it very important that the verification can be overriden by manually giving password. This probably won't be possible so I propose to make 2 mbrs: one with all features current mbr has (the default one) and another basic one (e.g. no chs) but with sha1 in it. Default to use is the first one but a user may explicitely override it

Quoted 3 lines

1. The disk must be encrypted.
2. The system must be able to boot without human interaction. That is, a user cannot be prompted for a passphrase or key.

The both goals together are theoretically unachievable technics like replacing ram (or gpu memory) with non-volatile storage is always available or the method of additional energy. All tpm does is to store it in obfuscated way and providing access to it in clear way if some conditions are met. Ideally this condition is B="my system is untampered"
BIOS has the duty to verify the condition A="mbr is untampered"

So actually what he needs is that grub ensures (A=>B)
Intermediary condition is "core.img" is untampered. I already outlined how to ensure C=>B without any sacrifices. Ensuring A=>C may require some sacrifices that's why I propose to have two versions of mbr sector. I find that the feature A=>B / C=>B is useful also in many ways not limited to tpm scenarios. Look at the following case:
One has installed grub locally on small disk or in flash memory (e.g. coreboot) in otherwise lightweight terminal. Now he wants to boot the OS from remote server over unsecure network.

In the same time he can always choose to boot unsigned OS by providing his password Regards
Vladimir 'phcoder' Serbinenko

#7 lore raw
In reply to Colin D Bennett
Quoted 4 lines · Colin D Bennett

While TPM may open a door for corporations to prevent machine owners from having control over their machines, in this instance I do not see another way to solve Alex's problem.

There's an easy way out of this. Simply verify data integrity from the flash chip, and make sure nobody can write to the flash chip.

You can archieve the first by e.g. installing coreboot/GRUB there and add some crypto support to it.

You can archieve the second by cutting the WE wire, or by dumping lots of concrete over your board. Yes, this is a gazillon times more secure than a TPM. TPMs are vulnerable to reverse engineering.

Quoted 2 lines

The evil part of TPM seems to be when a person buys a computer but the computer is locked down with a key not provided to the buyer.

Precisely. If it came with a key that is known to the buyer (e.g. printed on paper), or with an override mechanism that is only accessible to its legitimate buyer, there would be no problem with it.

But AFAICT there are no TPMs that do this. It probably even violates the spec.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#8 lore raw

And in this scenario the encryption key would also be in flash. Since you can't boot unchecked software and normal linux security wouldn't allow you to read flash unless you have the root password you can't recover the key Regards
Vladimir 'phcoder' Serbinenko

Quoted 25 lines · Robert Millan
Quoted 3 lines · Colin D Bennett

While TPM may open a door for corporations to prevent machine owners from having control over their machines, in this instance I do not see another way to solve Alex's problem.

There's an easy way out of this. Simply verify data integrity from the flash chip, and make sure nobody can write to the flash chip.

You can archieve the first by e.g. installing coreboot/GRUB there and add some crypto support to it.

You can archieve the second by cutting the WE wire, or by dumping lots of concrete over your board. Yes, this is a gazillon times more secure than a TPM. TPMs are vulnerable to reverse engineering.

Quoted 2 lines

The evil part of TPM seems to be when a person buys a computer but the computer is locked down with a key not provided to the buyer.

Precisely. If it came with a key that is known to the buyer (e.g. printed on paper), or with an override mechanism that is only accessible to its legitimate buyer, there would be no problem with it.

But AFAICT there are no TPMs that do this. It probably even violates the spec.

#9 lore raw
In reply to Robert Millan
Quoted 8 lines · Robert Millan
Quoted 3 lines · Colin D Bennett

While TPM may open a door for corporations to prevent machine owners from having control over their machines, in this instance I do not see another way to solve Alex's problem.

There's an easy way out of this. Simply verify data integrity from the flash chip, and make sure nobody can write to the flash chip.

Quoted 6 lines

You can archieve the first by e.g. installing coreboot/GRUB there and add some crypto support to it.

You can archieve the second by cutting the WE wire, or by dumping lots of concrete over your board. Yes, this is a gazillon times more secure than a TPM. TPMs are vulnerable to reverse engineering.

Everything is vulnerable to reverse engineering.
The problem with a TPM is not, that it uses bad/proprietary crypto, but as you state, that you can't own it completely.

Quoted 9 lines
Quoted 2 lines

The evil part of TPM seems to be when a person buys a computer but the computer is locked down with a key not provided to the buyer.

Precisely. If it came with a key that is known to the buyer (e.g. printed on paper), or with an override mechanism that is only accessible to its legitimate buyer, there would be no problem with it.

But AFAICT there are no TPMs that do this. It probably even violates the spec.

I also haven't seen a TPM that does it, but it is in the specs - called a revocable endorsement key - as an optional feature...

Greets,

Jan

#10 lore raw
In reply to phcoder

2009/2/19 phcoder <[email protected]>:

Quoted 5 lines

First of all your system is still totally vulnerable to emanation and power analysis or hw tampering. By reflashing bios one can bypass all tpm protections (don't say it's difficult because it's closed source and so on. Look at all closed source obfuscations/pseudo-protections that get cracked every day)

This is interesting. I have not thought about the way the BIOS is protected from tampering. You can probably read the BIOS and verify the signature with the TPM chip but there is nothing that can attest the machine actually used this BIOS for booting.

Since the BIOS is not stored in the TPM chip and must be able to reset the TPM chip into a good state at least when the power is removed from the board it must be possible to not use the BIOS at all and leave the TPM chip in good or resettable state.

The hard part is initializing the hardware without the use of the original BIOS - the specifics of initializing various chips are not public, and probably depend on companion hardware and/or trace length on the particular board as well.

Thanks

Michal

#11 lore raw
Quoted 5 lines

The hard part is initializing the hardware without the use of the original BIOS - the specifics of initializing various chips are not public, and probably depend on companion hardware and/or trace length on the particular board as well.

It's not actually needed. If one can nop tpm code in bios then he can boot from anything and read tpm keys. You don't need to understand the whole bios to do it. Of course it's obfuscated but obfuscation isn't a security in any way. Also if you write completely different code to flash bios you don't need to be able to initialise the whole hardware all you need is being able to read tpm and write to serial port. Then you can simply read the key at your serial console. Actually bios isn't protected. It's just obfuscated. Regards
Vladimir 'phcoder' Serbinenko

#12 lore raw
In reply to Alex Besogonov
Quoted 2 lines · Alex Besogonov

I know that TPM has been mentioned several times on this list. With absolutely inadequate knee-jerk reactions from GRUB developers :(

As far as I can recall, I think all my replies explaining why TPMs are a serious threat to our freedom were polite and respectful. Please think twice before labeling a reply you disagree with as "inadequate knee-jerk reaction", or it will be impossible to have a reasonable discussion over this issue.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."