Debian GNU/Linux · Boot & system hardening

Hide kernel addresses from users

When it fails: Kernel memory addresses are exposed through /proc and other interfaces. Leaked kernel addresses defeat kernel address randomization and help local privilege escalation exploits.

CB-DEB-BOOT-002mediumdraftautomatedautomated fixprofile core

Status draft: not part of any release yet, may still change.

Description

The kernel.kptr_restrict sysctl controls whether kernel pointers printed through %pK (for example in /proc/kallsyms and /proc/modules) are shown. With 1, they are hidden from users without the CAP_SYSLOG capability. With 2, they are hidden from everyone, including root.

Debian ships 0. The value can be raised at runtime; lowering it needs no reboot either.

Rationale

Kernel exploits need the address of kernel structures and functions. The kernel randomizes its own layout at boot, but a single leaked pointer is enough to undo that randomization. Hiding pointers removes an easy source of leaks for a local attacker.

Impact

With 2, profiling and tracing tools run as root (perf, some eBPF tools) see zeroed kernel addresses and cannot resolve kernel symbols. Use 1 on hosts where administrators need them.

Setting

Locationsysctl `kernel.kptr_restrict`, persisted in `/etc/sysctl.d/`
Default0
RecommendedAt least {{ kptr_restrict }}

Parameters

ParameterCoreServerServer hardenedDesktopDesktop hardenedBoundsDescription
kptr_restrictinteger222221 to 2Minimum value of kernel.kptr_restrict. 1 hides pointers from unprivileged users, 2 from everyone.

The value used is your override (tailoring file), else the profile's, else the one of the profile it extends, else the default. Bounds limit what an override may set.

Audit

Run sysctl kernel.kptr_restrict. The value must be at least {{ kptr_restrict }}. Then check that no sysctl configuration file sets a lower value.

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

running

Running value of kernel.kptr_restrict.

key: kernel.kptr_restrict
operator: '>='
value: '{{ kptr_restrict }}'

Remediation

Create /etc/sysctl.d/60-cirsec.conf containing kernel.kptr_restrict = {{ kptr_restrict }}, remove any other assignment of this key, then run sysctl --system.

Restartnone
Disruptionlow

Rollback

Remove the line from /etc/sysctl.d/60-cirsec.conf and run sysctl -w kernel.kptr_restrict=0.

set

Generated from check running: the engine writes the fix for every output, it sets the expected value and the check runs again after.

Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.

References

Mappings

FrameworkIDRelationNote
ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0R9partialR9 recommends 2 among other kernel settings; this control covers kernel.kptr_restrict only.
NIST SP 800-53 Rev. 55.1.1SC-30related

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. Generated check, fix and check again for profiles core and server-hardened; values kept after reboot; fix idempotent.
Verified2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64. Generated check, fix and check again for profiles core and server-hardened; values kept after reboot; fix idempotent.
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr