Debian GNU/Linux · Boot & system hardening

Protect the boot loader configuration with a password

When it fails: Anyone at the console can edit the boot entries. Editing the kernel command line at boot (for example adding init=/bin/sh) gives a root shell without any password.

CB-DEB-BOOT-011mediumactiveautomatedprofile core

As released in v0.1.0 beta · pre-release. Current state.

Description

GRUB can require a superuser name and password before anyone edits a boot entry or opens the GRUB command line. The password is stored as a PBKDF2 hash in the GRUB configuration. Marking the normal boot entries --unrestricted keeps unattended boots working: the password is only asked to change them.

Full disk encryption is the stronger protection against offline attacks. The GRUB password does not protect against booting another medium; restrict that in the firmware settings.

Rationale

Whoever reaches the console (physically, through a hypervisor console or a remote management card) can otherwise edit the kernel command line, boot into single-user mode or a shell, and bypass every account and audit control of the system.

Impact

Editing boot entries or using the GRUB shell during an incident needs the GRUB password. Store it with the other break-glass secrets. Boots without changes are not affected.

Applies when

Detected: when: GRUB is the boot loader A scanner reports the control not applicable when one is false.

Setting

Location`/etc/grub.d/40_custom` (or another file in `/etc/grub.d/`), compiled into `/boot/grub/grub.cfg`
DefaultNo password
RecommendedA superuser and a PBKDF2 password hash

Audit

In /boot/grub/grub.cfg, check that a set superusers= line and a password_pbkdf2 line exist.

Automated: every check must pass. Scanners report each check by its id.

superusers

A GRUB superuser is declared.

path: /boot/grub/grub.cfg
pattern: ^\s*set\s+superusers=

password

The superuser has a PBKDF2 password.

path: /boot/grub/grub.cfg
pattern: ^\s*password_pbkdf2\s+

Remediation

  1. Generate a hash: grub-mkpasswd-pbkdf2.
  2. Append to /etc/grub.d/40_custom:
    set superusers="root"
    password_pbkdf2 root grub.pbkdf2.sha512.10000.<hash>
    
  3. To keep normal boots unattended, add --unrestricted to the CLASS= line of /etc/grub.d/10_linux, or to each menuentry you want bootable without a password.
  4. Run update-grub, then reboot once from the console to confirm the default entry still boots.

Rollback

Remove the two lines from /etc/grub.d/40_custom and run update-grub.

References

Mappings

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

People and lifecycle

Authors
Verified2026-10-18 by Sn0wAlice on 12, Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64, BIOS boot. Manual procedure applied (pbkdf2 hash, --unrestricted); check passes; unattended reboot works.
Verified2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64, BIOS boot. Manual procedure applied (pbkdf2 hash, --unrestricted); check passes; unattended reboot works.
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr