Description
The kernel.dmesg_restrict sysctl controls who can read the kernel ring buffer with
dmesg or /dev/kmsg. With 1, only processes with the CAP_SYSLOG capability can read it.
Debian kernels are built with this restriction on by default, so the check usually passes on a fresh install. The control guards against it being turned off.
Rationale
Kernel messages often contain memory addresses, driver and firmware versions, and traces of failed operations. Reading them helps a local attacker tune a kernel exploit.
Impact
Unprivileged users can no longer run dmesg. Administrators use sudo dmesg or
journalctl -k, which needs membership of the adm or systemd-journal group.
Setting
| Location | sysctl `kernel.dmesg_restrict`, persisted in `/etc/sysctl.d/` |
| Default | 1 |
| Recommended | 1 |
Audit
Run sysctl kernel.dmesg_restrict. The value must be 1.
Then check that no sysctl configuration file sets it to 0.
Automated: every check must pass. Scanners report each check by its id.
running
Running value of kernel.dmesg_restrict.
key: kernel.dmesg_restrict
value: 1
Remediation
Create /etc/sysctl.d/60-cirsec.conf containing kernel.dmesg_restrict = 1,
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.dmesg_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/ (dmesg_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 lists several kernel settings; this control covers kernel.dmesg_restrict. |
| NIST SP 800-53 Rev. 55.1.1 | SI-11 | 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 |