{
  "id": "CB-UBU-BOOT-003",
  "standard": "ubuntu",
  "version": "main",
  "url": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-BOOT-003",
  "json": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-BOOT-003.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-BOOT-003.yml",
  "profiles_effective": [
    "core",
    "server",
    "server-hardened",
    "desktop",
    "desktop-hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-UBU-BOOT-003",
    "title": "Restrict the kernel log buffer to privileged users",
    "finding": {
      "title": "Unprivileged users can read the kernel log buffer",
      "description": "The kernel log can reveal addresses, hardware details and errors useful to an attacker."
    },
    "status": "active",
    "profiles": [
      "core"
    ],
    "risk": {
      "severity": "low"
    },
    "assessment": "automated",
    "tags": [
      "kernel",
      "sysctl",
      "information-disclosure"
    ],
    "description": "The `kernel.dmesg_restrict` sysctl controls who can read the kernel ring buffer with\n`dmesg` or `/dev/kmsg`. With `1`, only processes with the `CAP_SYSLOG` capability can read it.\n",
    "rationale": "Kernel messages often contain memory addresses, driver and firmware versions, and traces of\nfailed operations. Reading them helps a local attacker tune a kernel exploit.\n",
    "impact": "Unprivileged users can no longer run `dmesg`. Administrators use `sudo dmesg` or\n`journalctl -k`, which needs membership of the `adm` or `systemd-journal` group.\n",
    "notes": "Ubuntu kernels are built with this restriction on by default from 22.04 on, so the check\npasses on a fresh install and guards against it being turned off. The Ubuntu 20.04 kernel\n(5.4) is not: the check fails on a fresh 20.04 install and the fix turns it on.\n",
    "setting": {
      "location": "sysctl `kernel.dmesg_restrict`, persisted in `/etc/sysctl.d/`",
      "default_value": "1 (0 on 20.04)",
      "recommended_value": "1"
    },
    "audit": {
      "manual": "Run `sysctl kernel.dmesg_restrict`. The value must be `1`.\nThen check that no sysctl configuration file sets it to `0`.\n",
      "checks": [
        {
          "id": "running",
          "engine": "sysctl",
          "description": "Running value of kernel.dmesg_restrict.",
          "spec": {
            "key": "kernel.dmesg_restrict",
            "value": 1
          }
        }
      ]
    },
    "remediation": {
      "manual": "Create `/etc/sysctl.d/60-cirsec.conf` containing `kernel.dmesg_restrict = 1`,\nremove any other assignment of this key, then run `sysctl --system`.\n",
      "effects": {
        "restart": "none",
        "disruption": "low",
        "lockout_risk": false
      },
      "rollback": "Remove the line from `/etc/sysctl.d/60-cirsec.conf` and run `sysctl -w kernel.dmesg_restrict=0`.\n",
      "scripts": [
        {
          "id": "set",
          "from_check": "running"
        }
      ]
    },
    "references": [
      {
        "title": "Ubuntu Security documentation - Kernel protections",
        "url": "https://documentation.ubuntu.com/security/security-features/kernel-protections/",
        "publisher": "Canonical",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      },
      {
        "title": "Linux kernel documentation - Documentation for /proc/sys/kernel/ (dmesg_restrict)",
        "url": "https://docs.kernel.org/admin-guide/sysctl/kernel.html",
        "publisher": "The Linux Kernel Organization",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      },
      {
        "title": "ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R9)",
        "url": "https://messervices.cyber.gouv.fr/documents-guides/fr_np_linux_configuration-v2.0.pdf",
        "publisher": "ANSSI",
        "kind": "guide",
        "accessed": "2026-10-19"
      }
    ],
    "mappings": [
      {
        "framework": "anssi-linux",
        "framework_version": "2.0",
        "id": "R9",
        "relation": "partial",
        "note": "R9 lists several kernel settings; this control covers kernel.dmesg_restrict."
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "SI-11",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1082"
      },
      {
        "framework": "cwe",
        "id": "CWE-200"
      }
    ],
    "authors": [
      {
        "name": "Alice",
        "github": "Sn0wAlice"
      }
    ],
    "verified": [
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "20.04"
        ],
        "environment": "Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic, BIOS boot",
        "notes": "Fails on a fresh install (0); generated fix sets 1; kept after reboot; second remediate leaves it alone."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "22.04"
        ],
        "environment": "Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic, BIOS boot",
        "notes": "Passes on a fresh install (1); still passes after remediation and reboot."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "24.04"
        ],
        "environment": "Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic, BIOS boot",
        "notes": "Passes on a fresh install (1); still passes after remediation and reboot."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "26.04"
        ],
        "environment": "Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic, BIOS boot",
        "notes": "Passes on a fresh install (1); still passes after remediation and reboot."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}