{
  "id": "CB-UBU-BOOT-002",
  "standard": "ubuntu",
  "version": "0.1.1",
  "url": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-BOOT-002",
  "json": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-BOOT-002.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-BOOT-002.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-002",
    "title": "Hide kernel addresses from users",
    "finding": {
      "title": "Kernel memory addresses are exposed through /proc and other interfaces",
      "description": "Leaked kernel addresses defeat kernel address randomization and help local privilege escalation exploits."
    },
    "status": "active",
    "profiles": [
      "core"
    ],
    "risk": {
      "severity": "medium"
    },
    "assessment": "automated",
    "tags": [
      "kernel",
      "sysctl",
      "information-disclosure"
    ],
    "description": "The `kernel.kptr_restrict` sysctl controls whether kernel pointers printed through `%pK`\n(for example in `/proc/kallsyms` and `/proc/modules`) are shown. With `1`, they are hidden\nfrom users without the `CAP_SYSLOG` capability. With `2`, they are hidden from everyone,\nincluding root.\n",
    "rationale": "Kernel exploits need the address of kernel structures and functions. The kernel randomizes\nits own layout at boot, but a single leaked pointer is enough to undo that randomization.\nHiding pointers removes an easy source of leaks for a local attacker.\n",
    "impact": "With `2`, profiling and tracing tools run as root (`perf`, some eBPF tools) see zeroed kernel\naddresses and cannot resolve kernel symbols. Use `1` on hosts where administrators need them.\n",
    "notes": "Ubuntu ships `1` (`/etc/sysctl.d/10-kernel-hardening.conf`, `/usr/lib/sysctl.d/55-kernel-hardening.conf`\non 26.04), which hides pointers from unprivileged users only, so the check fails with the\ndefault parameter. The value can be raised at runtime; lowering it needs no reboot either.\n",
    "setting": {
      "location": "sysctl `kernel.kptr_restrict`, persisted in `/etc/sysctl.d/`",
      "default_value": "1",
      "recommended_value": "At least {{ kptr_restrict }}"
    },
    "parameters": [
      {
        "name": "kptr_restrict",
        "type": "integer",
        "description": "Minimum value of kernel.kptr_restrict. 1 hides pointers from unprivileged users, 2 from everyone.",
        "default": 2,
        "minimum": 1,
        "maximum": 2
      }
    ],
    "audit": {
      "manual": "Run `sysctl kernel.kptr_restrict`. The value must be at least {{ kptr_restrict }}.\nThen check that no sysctl configuration file sets a lower value.\n",
      "checks": [
        {
          "id": "running",
          "engine": "sysctl",
          "description": "Running value of kernel.kptr_restrict.",
          "spec": {
            "key": "kernel.kptr_restrict",
            "operator": ">=",
            "value": "{{ kptr_restrict }}"
          }
        }
      ]
    },
    "remediation": {
      "manual": "Create `/etc/sysctl.d/60-cirsec.conf` containing `kernel.kptr_restrict = {{ kptr_restrict }}`,\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.kptr_restrict=1`.\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/ (kptr_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 recommends 2 among other kernel settings; this control covers kernel.kptr_restrict only."
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "SC-30",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1068"
      },
      {
        "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 (1); generated fix sets 2; 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": "Fails on a fresh install (1); generated fix sets 2; kept after reboot; second remediate leaves it alone."
      },
      {
        "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": "Fails on a fresh install (1); generated fix sets 2; kept after reboot; second remediate leaves it alone."
      },
      {
        "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": "Fails on a fresh install (1); generated fix sets 2; kept after reboot; second remediate leaves it alone."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}