Lion Cipher Lab

Attest a machine's boot state with a TPM quote

Why it matters

Remote attestation answers a question you cannot answer with a password or a network scan: 'is this machine running the software I think it is, right now, and can it PROVE it to me over the network without me trusting the machine's own word?' A compromised host will happily report 'I am healthy' -- self-reported status is worthless once the reporter is owned. A TPM (Trusted Platform Module -- a small tamper-resistant chip, or a firmware equivalent) breaks that circularity. During boot and software load, each component is measured (hashed) and the hash is folded into a PCR (Platform…

What you'll learn

Steps in this lab

  1. The mental model: TPM, PCRs, and why a register you can only EXTEND is the whole trick
  2. Install swtpm + tpm2-tools and start the software TPM
  3. Point tpm2-tools at swtpm with TPM2TOOLS_TCTI, then run TPM startup
  4. Create the Endorsement Key (EK) -- the TPM's identity -- with tpm2_createek
  5. Create the Attestation Key (AK) -- the quote-signing key -- with tpm2_createak
  6. Extend a PCR with a known measurement so there is real state to attest
  7. Verifier issues a nonce; attester produces the signed quote with tpm2_quote
  8. Verifier checks the quote with tpm2_checkquote -- a passing attestation
  9. Break it on purpose: extend the PCR again, re-quote, watch checkquote FAIL
  10. Why the nonce matters: prove a recorded quote cannot be replayed
  11. when / why / better: the AK-trust problem, swtpm's missing root of trust, and Keylime

Open the full interactive lab →