Skip to content

attest/internal: skip SignatureHeaderSize vendor bytes in parseEfiSignatureList#502

Merged
liamjm merged 5 commits into
google:masterfrom
prasanna8585:fix/efi-signature-header-skip
May 22, 2026
Merged

attest/internal: skip SignatureHeaderSize vendor bytes in parseEfiSignatureList#502
liamjm merged 5 commits into
google:masterfrom
prasanna8585:fix/efi-signature-header-skip

Conversation

@prasanna8585

@prasanna8585 prasanna8585 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

parseEfiSignatureList() did not skip SignatureHeaderSize vendor bytes before reading signature entries, violating UEFI spec section 31.4.1.

Impact

For hashSHA256SigGUID lists, attacker-controlled vendor header bytes were appended directly to the trusted SHA256 hash list. A crafted TPM event log could inject arbitrary hashes into the verifier's trusted measurement database, allowing a remote attestation verifier to accept a compromised boot state as legitimate.

Fix

  • Add bound check: SignatureHeaderSize must not exceed remaining list space
  • Skip SignatureHeaderSize vendor bytes via buf.Seek() before both entry loops
  • Fix loop start offset for both certX509SigGUID and hashSHA256SigGUID handlers
  • Add regression test: TestParseEfiSignatureListNonZeroSignatureHeaderSize

Testing

=== RUN TestParseEfiSignatureListNonZeroSignatureHeaderSize
--- PASS: TestParseEfiSignatureListNonZeroSignatureHeaderSize (0.00s)
PASS

Reported via Google OSS VRP issue #513787653.
Security advisory: GHSA-9r4w-jg96-92mv

@google-cla

google-cla Bot commented May 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@prasanna8585 prasanna8585 changed the title attest/internal: skip SignatureHeaderSize vendor bytes in parseEfiSig… attest/internal: skip SignatureHeaderSize vendor bytes in parseEfiSignatureList May 16, 2026
Comment thread attest/internal/events.go Outdated
Comment thread attest/internal/events_test.go Outdated
Comment thread attest/internal/events_test.go Outdated
Comment thread attest/internal/events_test.go Outdated
@prasanna8585 prasanna8585 force-pushed the fix/efi-signature-header-skip branch from ea70dc1 to b6119d7 Compare May 18, 2026 09:27
@prasanna8585 prasanna8585 requested a review from liamjm May 18, 2026 09:32
liamjm
liamjm previously approved these changes May 18, 2026
…natureList

Per UEFI specification section 31.4.1, an EFI_SIGNATURE_LIST contains
SignatureHeaderSize bytes of vendor-specific data between the fixed
28-byte header and the actual signature entries.

parseEfiSignatureList() did not advance the buffer past these vendor
bytes before reading entries. For hashSHA256SigGUID lists, this allowed
attacker-controlled vendor header bytes to be appended to the trusted
SHA256 hash list. A crafted TPM event log could inject arbitrary SHA256
hashes into the verifier's trusted measurement database, enabling a
remote attestation verifier to accept a compromised boot state.

Fix:
- Validate: SignatureHeaderSize must not exceed remaining list space
- Skip SignatureHeaderSize vendor bytes via binary.Read before entry loops
- Fix both certX509SigGUID and hashSHA256SigGUID loop start offsets
- Add regression test confirming vendor bytes are not trusted as hashes

Reported via Google OSS VRP issue #513787653.
- Use buf.Seek() instead of binary.Read() to skip vendor header bytes
  (no need to allocate vendorHeader since we do not use its contents)
- Add sha256HashSize const instead of magic literal 32
- Reuse buildEFISignatureListData() in regression test
- Use efiSignatureListHeaderSize instead of magic literal 28
@liamjm liamjm force-pushed the fix/efi-signature-header-skip branch from b6119d7 to 1ca9f9b Compare May 19, 2026 01:37
@prasanna8585

Copy link
Copy Markdown
Contributor Author

Hi @liamjm - just following up. The PR has your approval and the CLA is green. Could you please approve the pending CI workflows when you get a chance? Also wanted to flag the related security advisory: GHSA-9r4w-jg96-92mv - happy to answer any questions.
Thank you!

@liamjm

liamjm commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Hi @liamjm - just following up. The PR has your approval and the CLA is green.

Please format the code, the linter is complaining.

Also wanted to flag the related security advisory: GHSA-9r4w-jg96-92mv - happy to answer any questions. Thank you!

ACK, I've published this

@prasanna8585

Copy link
Copy Markdown
Contributor Author

Hi @liamjm — pushed the gofmt fix in b6c9885, formatting is now clean. Could you please re-approve when you get a chance? Thank you!

Comment thread attest/internal/events_test.go Outdated
…c tests

Split TestParseEfiSignatureListNonZeroSignatureHeaderSize into:
- TestParseEfiSignatureListOversizedSignatureHeaderSize: verifies the
  bound check rejects SignatureHeaderSize >= remainingListSize
- TestParseEfiSignatureListVendorHeaderNotTrusted: verifies vendor bytes
  are skipped and do not appear in the trusted hash list
@prasanna8585 prasanna8585 requested a review from liamjm May 21, 2026 11:51

@liamjm liamjm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit, thanks.

Comment thread attest/internal/events_test.go Outdated
…sted

Check length and first element directly instead of iterating,
as suggested by reviewer.
@prasanna8585 prasanna8585 requested a review from liamjm May 22, 2026 05:05
@liamjm liamjm merged commit b6e905e into google:master May 22, 2026
12 checks passed
@prasanna8585

Copy link
Copy Markdown
Contributor Author

Thank you @liamjm for the thorough review, patience, and guidance throughout this process. It was a great learning experience contributing to go-attestation.

Regarding the CVE - GitHub indicated that Google is the registered CNA for this project and suggested contacting alphabet-cna@google.com. I will reach out to them directly to get a CVE assigned to advisory GHSA-9r4w-jg96-92mv. Please let me know if there is anything else needed from my side.

Thank you.

@liamjm

liamjm commented May 22, 2026 via email

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants