Linux Secure Boot adds a layer of trust that Windows does not have, the shim and its Machine Owner Key list, and that layer is where most Linux Secure Boot outages and most weak configurations come from. On a typical x86 server or laptop, firmware trusts a Microsoft-signed shim, shim trusts the distribution's key and any keys the machine owner has enrolled, and the kernel then decides which modules may load and whether root may modify the running kernel. Revocations through dbx and SBAT can make old boot media unbootable overnight, and a carelessly enrolled MOK can let anyone with that key sign code the machine will trust. This guide explains the Linux chain from shim to signed modules, who holds the keys, how to run MOK enrolment, kernel lockdown and module signing safely, and how to prepare for revocation events. It complements the platform-level Firmware and Boot Security Guide and is written for Linux platform engineers, endpoint teams and security architects.
Key takeaways
- The MOK list is a trust store you own. Any key in it can sign boot components and kernel modules that the machine will accept, so treat MOK private keys like code-signing keys.
- SBAT replaced hash-by-hash revocation. shim's generation-number scheme lets one
SbatLevelupdate revoke every vulnerable GRUB or shim build, which is efficient and also why outdated media suddenly stops booting. - Enforce module signatures.
module.sig_enforce=1orCONFIG_MODULE_SIG_FORCEblocks unsigned modules; in permissive mode they load and only taint the kernel. - Lockdown makes root less than the kernel. Kernel lockdown blocks
/dev/mem, unsigned kexec, BPF and kprobes restrictions, unencrypted hibernation and other paths from user space into the running kernel. - Disabling validation is a key event.
mokutil --disable-validationturns shim into insecure mode after a password prompt at the console; detect and prevent it on managed fleets.
How identity and access work in the Linux Secure Boot chain
Secure Boot is an identity system for code: each stage checks the signer of the next. On Linux the chain usually runs firmware, shim, GRUB, kernel, then kernel modules.
| Stage | Verified by | Trusted keys | Revocation |
|---|---|---|---|
shim (shimx64.efi) | UEFI firmware | UEFI db, typically the Microsoft UEFI CA (third-party) certificates | dbx hashes and certificates |
| GRUB and other second stages | shim | Distribution key built into shim, MOK list, and db unless disabled | dbx, MokListX, SBAT generation numbers |
| Kernel | shim protocol used by GRUB | Same as above | Same as above |
| Kernel modules | The running kernel | .builtin_trusted_keys (built in), .platform (db and MOK keys when Secure Boot is on) | .blacklist keyring populated from dbx |
| kexec images | The running kernel under lockdown | Kernel keyrings or IMA appraisal | As for modules |
The MOK variables
shim and MokManager keep their state in UEFI variables, documented in the shim source as MokVars.txt:
MokList: Authorised keys and hashes, boot-services only, with a runtime copyMokListRTexposed to the kernel.MokListX: Forbidden keys and hashes, with runtime copyMokListXRT.MokSBState: If set to 1, shim switches to insecure mode and stops validating.MokSBStateRTlets the OS see that state.MokDBState: If set, shim does not usedbfor validation, so only shim's built-in key and MOK are trusted.- Request variables:
MokNew,MokAuth,MokSBandMokPWare set bymokutilfrom the running OS and only act after a reboot, when MokManager asks the person at the console to confirm with the request password.
That reboot-and-confirm step is the security property: root on a running system can request a change but should not be able to complete it without physical or out-of-band console presence.
Admin roles and privileged access
| Role | Holds | Risk if misused | Control |
|---|---|---|---|
| Firmware administrator | UEFI setup password, PK and KEK control | Can disable Secure Boot or replace keys | Unique firmware passwords per device in a vault; BMC access restricted |
| MOK enroller | Console access during MokManager prompts | Can enrol a key that signs arbitrary boot code | Enrolment only for approved keys, by named staff, logged |
| Signing key custodian | MOK or module signing private keys | Can sign malicious modules trusted fleet-wide | HSM or PKCS#11 token, separate from build hosts |
| Linux root | Running system | Can request MOK changes, load signed modules, change boot entries | Lockdown, signature enforcement, monitoring of mokutil use |
- Remote consoles count as physical presence: On servers, the MokManager prompt appears on the BMC console. Anyone with BMC access can confirm a request, so BMC credentials belong in your privileged access process. See the Privileged Access Management Guide.
- Request passwords:
mokutil --importasks for a one-time password that MokManager later checks. Do not reuse a standard password across the fleet; an attacker with root who knows it can stage and then socially engineer the confirmation.
Integrations, API tokens and service accounts
The non-human identities in this chain are signing keys and the build systems that use them.
- DKMS and third-party drivers: Out-of-tree modules (GPU, storage, security agents) must be signed by a key the kernel trusts. Distributions commonly generate a local MOK for DKMS and prompt to enrol it. Every machine with its own locally generated, unprotected key is a machine where root can sign a rootkit module. For fleets, sign modules centrally with one managed key per product line instead.
- Custom kernels: The kernel build autogenerates
certs/signing_key.pemif no key is configured. The kernel documentation advises supplying your ownx509.genkeyand moving or destroying the private key rather than leaving it in the source tree.CONFIG_MODULE_SIG_KEYcan point to a PKCS#11 URI so the key stays in a token. - Signing tools: RHEL documents
efikeygenandpesignfor kernel images andscripts/sign-filefor modules;sign-filedoes not warn about certificate validity dates, so a module signed outside the key's validity period fails. - CI pipelines: A pipeline that signs modules is a code-signing service. Restrict who can trigger it, log every signature, and never expose the key to build steps that run untrusted code. See the Code Signing Security Guide.
Inventory each signing key with its owner, storage, scope and expiry, as you would any machine credential. See the Machine Identity, PKI and Certificate Lifecycle Guide.
SBAT and revocation events
Revoking boot code by image hash does not scale. The shim project's SBAT document records that the BootHole response in 2020 added 3 certificates and 150 image hashes to the x64 dbx, consuming about 10 kB of the roughly 32 kB typically available. SBAT (Secure Boot Advanced Targeting) instead embeds a .sbat section in each shim, GRUB and other component, listing a component name and generation number, and shim compares it against the SbatLevel UEFI variable.
- How a revocation works: When a vulnerability is fixed, the global generation for that component (for example
grub) is raised, and the newSbatLevelpayload rejects every binary with a lower number. Vendors also carry product-specific entries such asgrub.vendorcfor their own mistakes. - Published payloads: The shim repository's
SbatLevel_Variable.txtis the single source of these revocations, for example the 2022 revocations raisinggrubto 2 and later 3 andshimto 2 for named CVEs. Shim manages the variable on systems that run it; other operating systems booting under the UEFI CA can set it too. - End-of-life products: The SBAT document recommends raising a product's generation past any shipped binary when it reaches end of support, which deliberately stops it booting under Secure Boot.
Preparing for revocation outages
- Keep shim, GRUB and kernels current on every host, including rarely booted recovery partitions and appliances.
- Refresh boot media: PXE, ISO and rescue images must carry current signed shims, or they fail on machines that have applied newer revocations.
- Watch dual-boot and shared firmware: A revocation applied by one operating system lands in firmware variables shared by every OS on that machine.
- Stage dbx updates: Apply firmware revocation updates to a pilot ring that includes each hardware model and boot path before the fleet.
- Recovery path: Document how to boot recovery media and update shim on a machine that will not boot, and keep that media current.
For the Windows-side certificate rotation that followed BlackLotus, see the Firmware and Boot Security Guide.
Choosing a trust model
- Distribution default (shim plus vendor key): The right choice for most organisations. Revocations and signed updates arrive through normal packages; your work is keeping them current and keeping MOK empty or minimal.
- Distribution default plus one organisational MOK: Suits estates with in-house or third-party kernel modules. One centrally held key, enrolled through a controlled process, replaces dozens of per-machine DKMS keys.
- Own platform keys (custom PK, KEK and db): Removes reliance on the Microsoft third-party CA and lets you trust only your own signed boot chain, but you then own every signing, revocation and recovery step, including option ROMs on add-in cards. Reserve it for appliances or high-assurance fleets with mature PKI.
- Using
MokDBStateto ignore db: Narrows trust to shim's built-in key and MOK on machines that never boot Windows or other third-party loaders, at the cost of breaking anything signed only through db.
Logging and detection
- State checks:
mokutil --sb-statereports whether Secure Boot is enabled;mokutil --list-enrolledlists MOK keys;keyctl list %:.platformshows keys the kernel accepted from db and MOK. Collect these regularly and compare against an approved list. - Lockdown events: Blocked actions log
Lockdown: X: Y is restricted, see man kernel_lockdown.7. Unexpected entries from non-administrative processes deserve investigation. - Tainted kernels: In permissive mode an unsigned module loads and the kernel is tainted, with the module flagged
E. Alert on taint from unsigned modules. - Command monitoring: Audit execution of
mokutil(especially--import,--deleteand--disable-validation),efibootmgr,kexecand writes to/boot/efi. - Measured boot: Where TPM-based attestation is available, compare PCR measurements against known-good values to catch changed boot components. See the Linux Logging and auditd for Defenders Guide.
| Metric | Target |
|---|---|
| Hosts with Secure Boot enabled | 100% of capable hardware |
| Hosts with unapproved MOK keys | Zero |
| Hosts enforcing module signatures | 100% of servers |
| Hosts with lockdown in integrity mode or stricter | Rising to 100% where drivers allow |
| Boot media and images with current shim | 100% before each revocation is applied |
| Kernels tainted by unsigned modules | Zero |
Hardening baseline
Kernel lockdown
Kernel lockdown (Linux 5.4 and later, CONFIG_SECURITY_LOCKDOWN_LSM) blocks access to the running kernel image from user space. It restricts /dev/mem, /dev/kmem, /dev/kcore and /dev/ioports, BPF and kprobes, MSR writes and ioperm/iopl on x86, ACPI table overrides, debugfs, unencrypted hibernation, and loading of unsigned modules or kexec images unless IMA appraisal vouches for them. The lsm= boot parameter must include lockdown where it is set. The lockdown=integrity and lockdown=confidentiality boot options select the level; confidentiality additionally blocks reading kernel memory, which can break some tracing and diagnostic tools. Many distributions enable lockdown automatically when booted with Secure Boot, so check /sys/kernel/security/lockdown rather than assuming.
Rollout
- Inventory: Record Secure Boot state, enrolled MOK keys, out-of-tree modules and lockdown mode on every host.
- Clean up MOK: Remove unknown or per-machine DKMS keys after moving those modules to a centrally managed signing key.
- Enable Secure Boot on hardware where it is off, starting with a pilot ring per hardware model, with recovery media tested first.
- Enforce module signatures with
module.sig_enforce=1after confirming every required module is signed. - Enable lockdown in integrity mode; evaluate confidentiality for high-value hosts where tooling allows.
- Protect firmware: Set firmware passwords, restrict BMC console access, and keep
MokSBStateat secure mode. - Roll back safely: Kernel parameters can be reverted from the boot menu with console access; keep that path documented, and never "roll back" by disabling validation fleet-wide.
Framework mapping
| Control | Reference |
|---|---|
| Verified boot chain, SBAT, dbx | NIST SP 800-53 SI-7(9) Verify Boot Process; SI-7(15) Code Authentication |
| Module signature enforcement, lockdown | NIST SP 800-53 SI-7; CM-7 Least Functionality |
| Signing key custody | NIST SP 800-53 AC-6; CSF 2.0 PR.PS-01 |
| Attacks addressed | ATT&CK T1542.003 Bootkit, T1547.006 Kernel Modules and Extensions, T1014 Rootkit |
See the Rootkits and Bootkits Guide.
Common misconfigurations
- Secure Boot switched off to fix a driver: The most common outcome of a DKMS prompt nobody understood, leaving the whole chain unverified.
- Validation disabled in shim:
MokSBStateset to insecure mode, which keeps the firmware reporting Secure Boot enabled while shim validates nothing. Checkmokutil --sb-state, not just firmware settings. - Per-machine signing keys left on disk: Locally generated MOK private keys readable by root, so any root compromise can sign a persistent kernel module.
- Permissive module signing:
CONFIG_MODULE_SIGwithout enforcement, so unsigned modules load with only a taint flag. - Stale boot media: Old ISOs and PXE images that fail after an SBAT or dbx update, turning a security fix into an outage and pressure to disable Secure Boot.
- Lockdown assumed: Teams assume lockdown is active because Secure Boot is on, without checking the running mode.
Practitioner checklist
- Report Secure Boot state, MOK keys and lockdown mode from every Linux host.
- Maintain an approved MOK key list and remove anything not on it.
- Move module signing to a central key in an HSM or PKCS#11 token.
- Enforce module signatures with
module.sig_enforce=1on servers. - Enable lockdown in integrity mode and confirm it in
/sys/kernel/security/lockdown. - Keep shim, GRUB, kernels and all boot media current ahead of SBAT and dbx updates.
- Pilot firmware revocation updates per hardware model with tested recovery media.
- Restrict firmware passwords and BMC consoles that can confirm MokManager prompts.
- Alert on
mokutilchanges, kernel taint and lockdown violations.
Standards and references
- shim project: UEFI shim bootloader secure boot life-cycle improvements (SBAT)
- shim project: SbatLevel variable revocations
- shim project: Variables used by Shim and MokManager
- Linux kernel: Kernel module signing facility
- Linux man-pages: kernel_lockdown(7)
- Red Hat: Signing a kernel and modules for Secure Boot
- NIST: SP 800-53 Rev. 5
- MITRE ATT&CK: Bootkit
Related NHI Mgmt Group resources: Firmware and Boot Security Guide · Rootkits and Bootkits Guide · Firmware and Bootkit Compromise Playbook · Linux Kernel Hardening and sysctl Guide · Linux Package Signing and Repository Trust Guide