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
| Location | sysctl `kernel.kptr_restrict`, persisted in `/etc/sysctl.d/` |
| Default | 0 |
| Recommended | At least {{ kptr_restrict }} |
Parameters
| Parameter | Core | Server | Server hardened | Desktop | Desktop hardened | Bounds | Description |
|---|---|---|---|---|---|---|---|
kptr_restrictinteger | 2 | 2 | 2 | 2 | 2 | 1 to 2 | Minimum 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.
| Restart | none |
| Disruption | low |
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
- Linux kernel documentation - Documentation for /proc/sys/kernel/ (kptr_restrict) The Linux Kernel Organization, vendor-doc, accessed 2026-10-18
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R9) ANSSI, guide, accessed 2026-10-18
Mappings
| Framework | ID | Relation | Note |
|---|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R9 | partial | R9 recommends 2 among other kernel settings; this control covers kernel.kptr_restrict only. |
| NIST SP 800-53 Rev. 55.1.1 | SC-30 | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
People and lifecycle
| Authors |
|
| Verified | 2026-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. |
| Verified | 2026-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 in | v0.1.0 |
| Created, updated | 2026-10-18, 2026-10-18 |
| Translations | fr |