Repository navigation
uefi: In-memory Secure Boot authentication - #710
Closed
hotline1337 wants to merge 10 commits into
Closed
hotline1337 wants to merge 10 commits into
hotline1337 wants to merge 10 commits into
Conversation
hotline1337
marked this pull request as draft
November 9, 2026 17:47
hotline1337
force-pushed
the
feat/secureboot-attestation
branch
2 times, most recently
from
November 9, 2026 18:25
710b811 to
e8f015f
Compare
Centralize PE/COFF image header definitions into common/lib/pe.h and implement pe_is_valid() in common/lib/pe.c to validate DOS, NT, and optional headers for image loading and verification.
Ensure secure_boot_active strictly reflects the firmware SecureBoot state rather than being cleared when no config hash is enrolled in the binary. Enforce lockdown by disabling the bootloader editor, blocking UEFI Shell invocation, and rejecting unverified boot volume fallbacks under Secure Boot. Scope unhashed wallpaper and font skipping to enrolled configurations.
…ot hash policy Replace positional boolean flags with an explicit uri_flags bitmask (URI_ALLOW_HIGH_MEM, URI_AUTH_PE_VALIDATED, URI_RESOURCE_KERNEL) and update all protocol callers. Under Secure Boot: - Images flagged with URI_AUTH_PE_VALIDATED (linux, chainload) are permitted unhashed only if they are valid uncompressed PE binaries; the caller guarantees Authenticode verification via firmware / Shim MOK. - Kernels flagged with URI_RESOURCE_KERNEL (multiboot1, multiboot2, limine protocol) cannot be Authenticode-verified and always require an associated hash under Secure Boot, closing polyglot MZ header bypasses. - Non-executable resources (modules, initramfs, DTBs) require a hash only when a config hash is enrolled in the binary, permitting unhashed modules to load and be measured into TPM PCR 9 on unenrolled configurations.
Add transparent Shim integration via SHIM_LOCK_PROTOCOL (System V ABI thunking on x86) and an EFI_SECURITY2_ARCH_PROTOCOL override for in-memory image loads with strict fail-closed security. Original firmware verification hooks run first to ensure db-authenticated images log EV_EFI_VARIABLE_AUTHORITY in PCR 7 and EV_EFI_BOOT_SERVICES_APPLICATION in PCR 4, falling back to Shim verification for MOK-signed binaries.
…ement Align TPM measured boot with the TCG PC Client Platform Firmware Profile and the Linux TPM PCR Registry: - PCR 4: Linux kernel image - PCR 5: config as EV_EVENT_TAG 0xf5bc582a with 'limine.conf' description - PCR 8: cmdline and sanitized path descriptors - PCR 9: initramfs and DTB binaries Mitigate CVE-2021-42299 via dual TCG2/CC measurements.
…and adjust PCR measurement logic Implement shim_load_image usage in linux_x86 and linux_risc protos, ensure kernel image measurement goes to PCR 4 only when validated by shim, and propagate flag handling for high memory support.
…ment Add test cases covering Secure Boot enforcement: - Verify unhashed modules are permitted under unenrolled Secure Boot - Verify unhashed modules are rejected under enrolled Secure Boot - Verify polyglot MZ modules without hashes are rejected under enrolled Secure Boot - Verify unhashed multiboot/ELF kernels are rejected under unenrolled Secure Boot - Verify non-PE kernels panic under Secure Boot even when hashed
Reconcile USAGE.md, FAQ.md, and CONFIG.md with Secure Boot policies: - Authenticode PE verification for Linux kernels and chainload images - Hash requirements for non-PE kernels and data resources - Breaking change: mandatory PE Authenticode signing for Linux under Secure Boot - Align PCR 4, 5, 7, 8, and 9 documentation with TCG PC Client and Linux TPM PCR Registry
hotline1337
force-pushed
the
feat/secureboot-attestation
branch
from
November 9, 2026 19:08
ba61894 to
4aaf490
Compare
Assisted-by: Antigravity:gemini-4-carbon-low-preview Signed-off-by: hotline1337 <denuvo at tuta dot io>
Assisted-by: Antigravity:gemini-4-carbon-low-preview Signed-off-by: hotline1337 <denuvo at tuta dot io>
hotline1337
force-pushed
the
feat/secureboot-attestation
branch
from
November 9, 2026 23:35
ab92abf to
8406a0d
Compare
Contributor
Author
|
Closing this. Will resubmit the feature on a fresh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
linux_x86.c) and RISC architectures (linux_risc.cfor AArch64 and RISC-V), as well as chainloaded EFI applications viashim_load_image(). Firmwares validate PE images againstdb/dbxand Shim MOK, triggeringEV_EFI_VARIABLE_AUTHORITYrecording into TPM PCR 7.SHIM_LOCK_PROTOCOL(System V ABI thunking on x86) and anEFI_SECURITY2_ARCH_PROTOCOLoverride for in-memory image loads with strict fail-closed security, properly handling both legacy Shim and Shim 15.3+ / 16.EV_EVENT_TAG0xf5bc582awith descriptionlimine.conf), PCR 8 (cmdline and sanitized path descriptors), PCR 9 (initramfs / DTBs), with dual TCG2 and CC measurements on Confidential Computing platforms.secure_boot_activestate dynamically from UEFI variables (SecureBootandSetupMode) regardless of config hash enrollment, ensuring upstreamsecure_boot = 3signaling inboot_params(andlinux,uefi-secure-boot = <3>in Device Tree) is reliably passed to the OS.is_kernelclassification inuri_open(): unhashed initramfs/modules are permitted under unenrolled Secure Boot (and measured into PCR 9 for standard distro boots), while strictly mandating hashes for non-PE modules when a config hash is enrolled.common/lib/pe.c(pe_is_valid()).More to be filled here soon....
AI assistance disclosure
The feature was designed and verified by a human, and implemented with material AI help. Commits carry the corresponding
Assisted-by:trailer.