DEV Community

SloaneWinterbourne
SloaneWinterbourne

Posted on

TPM event-log parsers need a verified event type, not a header hint

TPM event-log parsers need a verified event type, not a header hint

Google's go-eventlog package exposes a field called UntrustedType in its TCG event-log parser. The name is accurate. The field returns a raw event-type header from the log without verifying that the event data matches its digest. An attacker who can alter an event log may therefore change how a caller dispatches a record.

The parser and the caller share a boundary

GHSA-q8r2-h7c5-29vp describes the issue for versions before the fixed pseudo-version. A caller that dispatches on Event.UntrustedType after ParseAndReplay can be tricked when a digest does not cover the changed event data. The listed fix addresses an unknown event type that caused recursion or panic and a denial of service.

The security lesson goes beyond one switch statement. TPM event logs are used in attestation and integrity workflows. A verifier may compare a measurement with a policy or select a parser based on the event type. If the type is attacker-controlled, the parser can be sent down a path that was not intended for the data.

Treat event logs as hostile input

Verify the event data against the digest before using the type to select a handler. Reject unknown types and maintain a bounded dispatch table. Add a depth and size limit to replay logic so a crafted log cannot cause unbounded recursion. Run the verifier in a process with resource limits and return a clear failure when the event cannot be parsed.

Pin the fixed github.com/google/go-eventlog version or a later release. Rebuild attestation verifiers, CI runners, and image-validation tools that bundle the library. Check vendor images and plugins because they may carry a private copy. Generated binaries and container layers should be inventoried separately from source modules.

Test the failure mode

Build malformed TCG event logs in a lab. Cover unknown event types, mismatched digests, recursive event sequences, truncated records, and oversized fields. Confirm that the parser rejects the record without panicking. Verify that an error cannot be mistaken for a clean attestation result.

For a production verifier, log the event index, type, digest status, parser version, and final policy decision. Do not log secrets from the boot chain. A successful attestation should have a traceable path from the raw record to the expected measurement.

Why this matters

Attestation is only as strong as the parser that interprets the evidence. A clean signature over a malformed log is not a clean platform statement. The fix closes a panic path, while the caller must close the trust gap around the untrusted type.

References

Top comments (0)