Skip to content

feat: sealed TPM audit log — NV_Extend chain for hardware-rooted tamper-evident event log #44

Description

@nielsweistra

Problem

The audit log records events at the application layer, but there is no hardware-rooted, tamper-evident record of attestation events. An attacker with database access can truncate or alter the audit log without any indication that the TPM state diverges from the logged events.

Solution — Sealed TPM Audit Log (NV_Extend Mode)

Each attestation event extends a TPM NV index using TPM2_NV_Extend. The cumulative hash is cryptographically bound to the sequence of events — it is impossible to retroactively alter without physical access to the TPM.

Server-side Registry

The server maintains a TpmAuditLog table that mirrors the expected NV chain:

# models/tpm_audit.py
class TpmAuditLog(Base):
    id: uuid
    machine_id: uuid
    sequence_number: int     # monotonically increasing per machine
    event_type: str          # attest / enroll / revoke / mission_activate / wipe
    event_payload_hash: str  # SHA-384 of event data
    nv_extend_hash: str      # expected TPM NV value after this extend
    recorded_at: datetime

NV Extend Chain

Each event: nv_value[n] = SHA-384(nv_value[n-1] || event_hash[n])

This mirrors how PCR extend works, but on NV RAM (persistent across reboots, not cleared on TPM reset unless explicitly authorized).

Client writes

itl-tpm-register (Talos extension) calls TPM2_NV_Extend after:

  • Successful attestation
  • Phase delta applied
  • Broadcast wipe received

Verification

GET /api/v1/forensics/audit/{machine_id}

Server returns the NV chain. Forensic operator can compare against physical TPM NV readout to detect any log tampering.

NV Index

ITL_TPM_AUDIT_NV_INDEX=0x01500001 (configurable, in owner handle space)

MITRE ATT&CK

  • T1565 — Data Manipulation (mitigated: TPM NV chain detects any alteration)
  • T1070 — Indicator Removal (mitigated: TPM NV is hardware-rooted)

Files

Companion issue

  • ITL.Talos.HardenedOS: itl-tpm-register TPM NV audit log writes (companion to this issue)

Dependencies

Acceptance Criteria

  • Every attestation event appends a row to TpmAuditLog
  • NV chain hash correctly extends: nv[n] = SHA384(nv[n-1] || event_hash[n])
  • GET /forensics/audit/{machine_id} returns full NV chain with sequence numbers
  • Tampered row detectable: altering any row breaks the NV chain from that point
  • Test: 5 events → chain has 5 entries; alter entry 3 → entries 3-5 chain mismatch

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact:5Impact score 5 (Fibonacci)military-gradesecuritySecurity vulnerability or hardeningtype:epicLarge body of work spanning multiple sprintstype:storyUser story -- a piece of deliverable value

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions