Signing TLS handshakes inside a TPM
Posted by bschaatsbergen 1 day ago
Comments
Comment by duk3luk3 1 day ago
Comment by abound 1 day ago
> That’s the third property, and it’s the one that decides this.
and I gave up at that point.
Comment by bschaatsbergen 1 day ago
Comment by nilsherzig 1 day ago
Comment by bob1029 1 day ago
The TPM will give you stronger assurance that a machine owns a key, but it's likely that a dedicated HSM would be much harder to extract the key material from.
TPM being inside the machine is a double edged sword. On one hand it makes attestation feasible, but on the other you now have the security black box inside the same physical domain as the machine that uses it. Risk of side channel extraction goes up dramatically when these systems coexist. It's a lot harder to instrument an HSM across the network.
Comment by flippingheck 1 day ago
ARM TrustZone, for example, can run this OSS TPM: https://github.com/OP-TEE/optee_ftpm
I expect there are equivalents for Intel/AMD.
Comment by mjg59 1 day ago
Comment by bob1029 1 day ago
In every case of TLS I've seen we are concerned with organizational identity, not machine identity. This effectively extends to client certificates in cases like B2B & vendor integration.
In both scenarios you would definitely want to use an HSM style solution.
Protecting the HSM from inappropriate use (proving you are allowed to sign using the keys within) is a problem orthogonal to protecting the key material. In cloud HSM applications, you often combine the cloud vendors managed identity solution and HSM policies to effectively bind a set of machines to a set of keys.
Comment by jon-wood 1 day ago
At work we deploy industrial IoT gateways, these are very much not end-user devices. We are actually concerned about the device's identity, and more specifically about being able to attest that the device is in fact the one we thought it was and it hasn't been tampered with. By putting the key for TLS client certificate in the device's TPM, locked behind attestation that what's been booted is what we expected to boot, we can have a reasonable degree of confidence that we're communicating with the device we thought we were rather than just someone who managed to copy the private key off disk.
Comment by mjg59 1 day ago
Comment by thomashabets2 1 day ago
https://blog.habets.se/2012/02/Benchmarking-TPM-backed-SSL.h...
https://blog.habets.se/2012/02/TPM-backed-SSL.html
Well, it's been over 14 years so I should hope so.
Comment by mjg59 1 day ago
[1] Typically ARM these days, but most system vendors aren't picking TPM vendors based on performance
Comment by bschaatsbergen 1 day ago
Worth adding that not every outbound connection needs to go through the TPM (IMO). It's for the handful of services where the machine-identity actually matters, a secret store, or an HSM releasing key material onto an attested confidential VM, in my case.
Comment by mjg59 1 day ago
Comment by flippingheck 1 day ago
Not suitable for servers, since it's such an easy DoS vector.
Comment by KaiserPro 1 day ago
my threat model was reasonably technical engineer swapping drives for some reason, or someone claiming that the machine is "different". (no nation state shit)
after the machine was imaged, it would connect to our central config server, get its hostname and exchange keys which would be embedded in the TPM.
once the machine is shipped and booted, it'll check in and sign a challenge. any kind of action on the central API could have a challenge. Each machine is attested at least once an hour.
I'm not sure how "secure" it all is, but it seems to work.
Comment by mjg59 1 day ago
Comment by ted_dunning 1 day ago
This means that the root of trust threads through software (TAS) that verified that your attestation evidence matches the live policy. This works with no changes to Spiffe.
This doesn't really meet your requirements to keep the key out of memory since the resulting SVID lasts for several minutes in memory, but it does meet most people's needs.
Comment by mjg59 1 day ago
Comment by bschaatsbergen 1 day ago
Comment by yusufmotiwala 1 day ago
We faced a similar issue (we use OpenSSL). OpenSSL does have OPENSSL_secure_malloc() which prevents sensitive memory from being dumped. However, the problem is that not all paths use the secure allocator. For example, this issue: https://github.com/openssl/openssl/issues/27603
Not sure if this has changed in OpenSSL 4.x, but it is certainly something desirable.
Comment by ram_rattle 1 day ago
https://datatracker.ietf.org/doc/draft-fossati-tls-attestati... https://www.youtube.com/watch?v=MF9AwkMJOlw
Comment by bschaatsbergen 1 day ago
What I'm doing changes nothing on the wire, the verifying side has no idea a TPM is involved. In RATS (https://www.rfc-editor.org/rfc/rfc9334.html) we prove a machine is sound by measuring it and appraising the evidence. But after attestation the usual thing is to hand the machine a short-lived identity saying it is attested, and when that machine then authenticates over mTLS to something like an HSM, the thing that gives that machine its identity is a private key in a file. That bothered me. What I want is to tie the key in the TPM to the evidence of the confidential VM at issuance time, and let that be the identity the machine carries afterwards. Working notes while implementing RFC 9334.
Comment by ram_rattle 1 day ago
Hat Tip!
Comment by ted_dunning 1 day ago
It really better to separate the attestation, the check against policy and then the TLS stuff. Solve one problem at a time, sign that progress and move on.
Comment by madduci 1 day ago
Comment by ivlad 1 day ago
Also, with real TPM, the key could be locked to a specific configuration register value, which makes less sense for VMs. “Quote” is mentioned and I guess author means that, but did not elaborate further.
Comment by flippingheck 1 day ago
PKCS11 doesn't allow you to attest that the key is resident in the PKCS11 provider, which as you say, the author alludes to, but doesn't cover.
> with real TPM, the key could be locked to a specific configuration register value, which makes less sense for VMs.
A vTPM is as real as a physical TPM chip.
The question is which TPM endorsement certificate CAs you are willing to trust.
For some that might the manufacturer of TPM chips, for others it might be their VM provider. (For some, none: for some both!)
Trusting their VM provider isn't so crazy if the VM provider is able to influence the guest code anyway.
Comment by ivlad 1 day ago
You don’t need that if you include quote in CSR and then CA validates the quote and writes the validation result in the certificate. Certificate then contains proof that private key is in TPM.
Comment by flippingheck 1 day ago
That said, TPM quotes are attesting the value of TPM PCRs which are just registers of hashes (representing the state of the machine).
When making a CSR, you can use https://tpm2-tools.readthedocs.io/en/latest/man/tpm2_certify... to attest a key is TPM-resident.
I think your central thesis is that at the time of TLS establishment, why not use PKCS11 (with a cert signed by a CA that has validated a TPM certification), and I agree: services should probably integrate via PKCS11.
Comment by flippingheck 1 day ago
Sorry to have missed that!
Comment by psanford 1 day ago
Comment by bschaatsbergen 1 day ago
Comment by donavanm 1 day ago
That said, even 3ms TPM signatures are going to be for special cases or novelty. Plain old CPU tls will do about 1ms cpu time per request which will scale by cpu core count. One or two orders of magnitude more throughput per host.
Comment by jauntywundrkind 1 day ago
The War Against General Purpose Computing ticks on.
Comment by lesspassiveobse 1 day ago
Comment by bschaatsbergen 1 day ago
Comment by lesspassiveobse 1 day ago
Comment by flippingheck 1 day ago
> even if you don't have the keys you may still control the implementation
The sorts of places that care about remote attestation also care about insider risk.
Comment by ranger_danger 1 day ago
It's bad enough that ssh does this by default with all your keys.
Comment by zx8080 1 day ago
Comment by altairprime 1 day ago
Comment by ranger_danger 1 day ago
Of course the website itself would need to support that, but it's all possible in time.
Comment by altairprime 1 day ago
https://privacysandbox.google.com/blog/update-on-plans-for-p...
Comment by ranger_danger 16 hours ago
Comment by _flux 1 day ago
I suppose client cert would protect against from a MitM attack, if the client failed to notice it, or if the MitMer has the website keys to make a perfect attack.
Comment by bschaatsbergen 1 day ago