Confidential Computing & Hardware Enclaves (TEEs)
Protect data in use with Nitro Enclaves, Intel TDX, and AMD SEV-SNP: remote attestation quotes, KMS release policies, and enclave side-channel limits.
In this lesson (4 bite-sized sections)
Closing the data-in-use gap
TLS protects data in transit and KMS envelope encryption protects data at rest, yet the moment an application decrypts a record to process it, plaintext sits in host RAM. On a standard cloud server, anyone with root access on the host OS, a compromised hypervisor, or physical access to memory chips can dump process memory and steal both the data and the decryption keys.
Confidential computing closes this data-in-use gap using a hardware-enforced Trusted Execution Environment (TEE). The CPU or hypervisor isolates an enclave's memory pages, encrypts DRAM with hardware-managed keys, and blocks the host OS and cloud operator from inspecting registers or memory inside the boundary.
Enclave models: Nitro Enclaves, TDX, SEV-SNP, and PCC
Production TEEs fall into two main shapes. Process or VM enclaves like AWS Nitro Enclaves carve isolated CPU cores and RAM off an EC2 host with zero persistent disk, zero SSH, and zero external network, leaving only a local vsock channel to the untrusted parent host. Confidential VMs like Intel TDX and AMD SEV-SNP encrypt an entire guest VM's memory at the silicon memory controller so unmodified Linux workloads run inside a hardware trust boundary. Apple Private Cloud Compute (PCC) extends the same principle to custom Apple silicon racks with published binary transparency logs so external researchers can audit the exact inference code running in the cloud.
| Platform | Isolation boundary | Host / operator visibility | Operational tradeoff |
|---|---|---|---|
| AWS Nitro Enclaves | Isolated sibling VM carved from EC2 host | Parent host sees only encrypted vsock traffic | No disk or direct network; requires vsock proxy and minimal image |
| Intel TDX / AMD SEV-SNP | Hardware-encrypted full Confidential VM | Hypervisor cannot read guest RAM or registers | Easier lift-and-shift, larger trusted computing base (full guest OS) |
| Apple Private Cloud Compute | Custom Apple silicon nodes + stateless OS | No persistent storage, no remote shell, verifiable build logs | Vertically integrated hardware stack; strongest auditability |
Remote attestation turns code identity into key access
Hardware isolation alone proves nothing to a remote caller or KMS: how does KMS know it is talking to your audited binary inside a genuine enclave rather than a modified copy running on an attacker's laptop? Remote attestation (modeled in RFC 9334, RATS) binds cryptographic identity to exact boot measurements.
During boot, the hardware hashes the enclave image and configuration into tamper-proof registers (such as PCR0 in Nitro or MRTD in TDX). The enclave generates an ephemeral asymmetric keypair inside isolated memory and asks the hardware root of trust to sign an attestation quote containing both the boot measurement hashes, the enclave's public key, and a fresh verifier nonce.
- Boot & Measurehardware hashes image into PCR/MRTD
- Signed Quoteroot of trust signs PCR + enclave pubkey
- KMS Policy Checkverifies signature, PCR allowlist, nonce
- Wrapped DEKKMS encrypts DEK to enclave pubkey
- Decrypt in RAMonly enclave privkey unwraps DEK
Side channels, rollback, and layered defense
TEEs shrink the trusted computing base, yet they are never magic armor. First, microarchitectural side channels (cache timing, speculative execution, memory-access page faults) can leak secrets if code branches or indexes tables on secret bytes; cryptographic routines inside enclaves must remain constant-time. Second, because enclaves are stateless and rely on an untrusted host for storage, an attacker can mount a rollback attack by feeding an older valid encrypted disk snapshot back to the enclave to reset rate limits or replay spent states. Defending against rollback requires monotonic hardware counters or an external consensus log. Third, you still need TLS termination inside the enclave (not on the parent host) and authenticated encryption for every byte leaving enclave RAM.
Separate threats blocked by a TEE plus remote attestation from threats that still need outside defenses.
Sort 5 more items to check
Sources: AWS Nitro Enclaves User Guide · RFC 9334, RATS Architecture · Apple Private Cloud Compute
Apply
Your turn
The task this lesson builds to.
Review the MedInfer specification below and detail an enclave-backed inference architecture covering remote attestation, KMS key-release policy, zero-downtime image upgrades, and rollback protection.
MedInfer confidential inference spec (read only)
Workload. MedInfer runs oncology CT-scan inference across cloud compute nodes processing 600 scans per minute. Each hospital tenant encrypts DICOM images under its own KMS-managed DEK before upload.
Threat model. Hospital compliance assumes a compromised cloud host OS or rogue cloud administrator may inspect host RAM, parent disk volumes, and local network interfaces.
Operational requirements.
- Plaintext DICOM scans and decrypted tenant DEKs may only exist inside hardware-isolated enclave memory.
- KMS may release a tenant's DEK solely to audited, reproducibly built MedInfer release images.
- Weekly model and runtime upgrades must roll out with zero downtime and without exposing state to snapshot rollback.
Think about
- Why must TLS terminate inside the enclave rather than on the parent host load balancer?
- What happens to live KMS key-release policies during a rolling upgrade when PCR0 changes?
- How could a malicious host exploit rollback if the enclave caches tenant quota or audit state on host disk?
Draft your design answer here Save your draft, compare against the model answer, and track progress.
Practice
Make it stick
A second problem on the same idea, so it survives past today.
Specify a multi-party fraud analytics clean room where two competing banks join transaction tables inside confidential VMs without either bank or the cloud operator viewing the other party's raw rows, addressing reproducible builds, mutual attestation auditing, and output privacy.
Think about
- How do both banks verify that the exact SQL or join binary running inside the CVM contains no hidden export path?
- What stops one bank from running crafted queries that reconstruct the other bank's individual customers from aggregate outputs?
- Why must both banks' KMS keys require the identical mutually signed measurement digest?
Draft your design answer here Save your draft, compare against the model answer, and track progress.