Pcornel
Security · Linux Security

Kernel Hardening

Cheat sheet · https://pcornel.dk/topic.php?topic=4577

Back to the Topic

Answer

Linux Kernel Hardening reduces kernel exploitation and persistence through supported mitigations, memory protections, module and debug restrictions, lockdown/verified boot relationships, secure sysctl policy, attack-surface reduction and timely kernel/firmware updates.

Remember

  • Kernel hardening parameter set ≠ compiled feature supported or effective.
  • Mitigation enabled ≠ kernel vulnerability patched or exploitation impossible.
  • Configuration file present ≠ parsed, loaded and effective runtime state.
  • One allow/deny result ≠ complete DAC, privilege, LSM, firewall and application outcome.

First checks

  • sysctl kernel.kptr_restrict kernel.dmesg_restrict kernel.unprivileged_bpf_disabled kernel.yama.ptrace_scope — hardening sysctls
  • cat /sys/kernel/security/lockdown — lockdown mode
  • grep -E 'CONFIG_(STACKPROTECTOR|FORTIFY)' /boot/config-$(uname -r) — build options

Verify in this order

kernel settings → reduced attack surface

Where it usually breaks

First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.

Linux Security → Kernel Hardening proof map

BoundaryEstablishDoes not establish
ScopeExact host, role, build/kernel, identity, workload and expected controlDoes not prove policy receipt or effective runtime state
Effective stateResultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controlsConfiguration presence does not prove enforcement
Runtime evidenceCorrelated events/audit, process/token/credential, packet/syscall and workload resultOne event, clean status or allow/deny does not prove complete security
ClosureOriginal allowed/denied workload works, unsafe state is removed and recovery/regression passCommit, restart, block or compliance result alone is not closure

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4577

Confirmation

Confirm action

Continue?