OGOPSEC Brand Mark
OGOPSECOBSIDIAN GOOSE

OGOPSEC // Dispatch

TPM-Backed Authentication: Binding Secrets to Hardware

By Jamie Folsom ·

Most authentication secrets are just files. A private key, a token, a hashed password in a database — copy the bytes and you copy the capability. TPM-backed authentication breaks that assumption by storing the secret inside a Trusted Platform Module, where the private material never leaves the chip in a usable form. The credential stops being portable data and becomes a property of one specific machine.

That single change closes a surprisingly large category of attack. The classic breach where someone exfiltrates a key file and uses it from their own laptop simply does not work if the key lives in your TPM. But like every real control, it trades one problem for a narrower one, and knowing the new shape of the problem is the job.

How the binding actually happens

A TPM can create a key whose private half is generated inside the chip and marked non-duplicable. Software can ask that key to sign a challenge or decrypt a blob, but it can never read the key out. When a login flow needs proof of identity, it hands the TPM a challenge; the TPM signs it; the verifier checks the signature. The proof is only producible on the machine that holds the key.

# Create a primary context and a signing key under it
sudo tpm2_createprimary -C o -g sha256 -G ecc -c primary.ctx
sudo tpm2_create -C primary.ctx -G ecc -u key.pub -r key.priv
sudo tpm2_load -C primary.ctx -u key.pub -r key.priv -c key.ctx

The key.priv file is not the key — it is an encrypted blob only this TPM can use. Lose the chip, and the blob is inert.

Adding a policy: not just the machine, but the right state or PIN

Raw machine-binding is useful, but you usually want a second condition: a PIN the user knows, or a requirement that the system booted into a known state. The TPM enforces these as policies attached to the key.

  • Auth value (PIN): the key will not operate without a secret the user supplies, so a stolen but powered-off machine is not enough.
  • PCR policy: the key only works when boot measurements match, so tampering with the bootloader locks the credential.
  • Counter policy: the key is tied to a monotonic counter, so old sealed states cannot be replayed.

Crucially, the TPM's dictionary-attack protection throttles PIN guessing in hardware. A four-digit PIN behind a TPM is far stronger than a four-digit PIN checked by software, because the chip will lock out after a handful of failures rather than allowing millions of offline attempts.

What this stops

  • Credential theft by file copy — the secret is not a file.
  • Reuse of the credential on another device — it is bound to this TPM.
  • Offline brute force of a PIN — the TPM rate-limits and locks out.
  • Silent rollback to a previously captured state — counters and PCRs refuse it.

What it does not stop

Here is the part marketing pages skip. TPM-backed authentication protects the secret at rest and its use, not the session it unlocks. If malware is already running as your user, it can ask the TPM to authenticate on your behalf while you are logged in — the chip has no idea the request is malicious. It does not defend against a compromised application that misuses a legitimately unlocked key, against social engineering, or against a bug in the PAM module or agent that fronts the TPM. And a firmware TPM shares silicon with the CPU, so it offers less resistance to advanced physical attacks than a discrete module.

Binding a secret to hardware answers one question well: "can this credential exist anywhere else?" It does not answer "is the right person using it right now?" Those are different controls.

Designing around the limits

Because the TPM guards the key but not the live session, good designs pair it with something that watches presence and context: a PIN or passphrase for the at-rest case, screen locking on idle, and a policy that re-requires proof for sensitive actions. A credential that is TPM-bound and requires a physical token to be present gives you two independent facts — the machine is this machine, and the token is here — which is materially stronger than either alone.

That layered posture is exactly how Dire Wolf uses the TPM: the device key is TPM-bound so it cannot be cloned, the PAM integration fails closed when the credential is absent, and the chip's lockout logic throttles guessing. The TPM is the anchor, not the entire mechanism. Treat it that way in your own builds and you will get the real benefit — uncopyable secrets — without talking yourself into a false sense of total protection.