A kernel privilege escalation turns a low-privileged shell into root by attacking the kernel itself rather than a misconfigured program. It is the riskiest route on a Linux host: a failed attempt can take down the one component only a reboot restores, so on a client system it needs explicit written permission naming the host. This article covers checking exposure without exploiting it, and closing the gap. Test only networks and systems you own or are authorised to assess.
What it is and why it is the riskiest route
MITRE tracks the class as T1068, Exploitation for Privilege Escalation: exploiting a programming error in a program, a service, the operating system or the kernel to run code at a higher privilege. A local flaw needs a foothold first, such as a shell, covered in shell listeners and TTY upgrades; the Windows equivalent is Windows privilege escalation.
A weak sudo rule uses features working as designed, while a kernel exploit triggers a bug, often a race or a memory-safety flaw. If it goes wrong the kernel hits an oops and either tries to continue or, with kernel.panic_on_oops at 1, panics. Report “exposed, with evidence” rather than proving it by exploitation.
Identify the kernel and the distribution
uname -r prints the kernel release and uname -v the kernel version string. /etc/os-release identifies the distribution and release in a standard format.
Debian, as its security FAQ explains, backports fixes to the version a stable release shipped, so a fixed package can carry an older number: for CVE-2022-0847 the upstream fix landed in 5.10.102, yet Debian’s tracker lists bullseye as fixed in 5.10.92-2. uname -r hides even that: before Debian 13 it shows an ABI name such as 5.10.0-16-amd64, whose third number is always 0. The authority is the distribution’s tracker, checked against the exact package version installed.
Suggesters, and which to trust
linux-exploit-suggester (LES), from The Z-Labs, matches a host against public privilege escalation exploits, kernel and userspace. Its latest tag is v1.2 (February 2026). --uname reads a saved uname -a string, so the check runs on your own machine, and --pkglist-file adds saved dpkg -l or rpm -qa output for the userspace checks. In --uname mode it skips its configuration and sysctl checks, which --skip-more-checks turns off on the host. --show-dos adds denial-of-service entries, hidden by default.
LES takes the version from the release field of uname -a, cut at the first hyphen. On Debian 11 that is 5.10.0, inside its Dirty Pipe range of 5.8 to 5.16.11, so it lists Dirty Pipe whether the kernel is patched or not. A suggester’s output is candidates to confirm against the tracker, never a verdict.
kernelpop, from the spencerdodd GitHub account, is a similar framework. Its last commit is from August 2018 and its newest entries are 2017 CVEs, so it cannot report Dirty Pipe: treat it as unmaintained, and a clean result from it as meaningless.
Three CVEs readers confuse
Dirty COW, CVE-2016-5195. A race in the kernel’s copy-on-write handling of private read-only mappings, in mm/gup.c, that let an unprivileged user write to read-only mappings; it was exploited in the wild in October 2016. The NVD description says kernels before 4.8.3, but its configuration data starts at 2.6.22 and lists a fixed release on each stable branch, such as 4.4.26. The kernel fix credits Phil Oester as reporter, and the dirtycow.ninja FAQ names him as the finder, from an exploit caught in an HTTP packet capture.
Dirty Pipe, CVE-2022-0847. Max Kellermann of IONOS found it and wrote it up in The Dirty Pipe Vulnerability. Present since 5.8, it lets an unprivileged process overwrite data in arbitrary read-only files and so escalate privileges. He gives the fixes as 5.16.11, 5.15.25 and 5.10.102, and calls it similar to Dirty COW but easier to exploit.
PwnKit, CVE-2021-4034, is not a kernel bug. Qualys found it in polkit’s pkexec, a setuid-root program, so a kernel update does nothing for it. LES lists it as a userspace exploit when it can read the package list. Report userspace and kernel exposure separately.
Check exposure without exploiting
Look the CVE up on the distribution’s tracker, which states per release and package whether it is fixed, in which version, or “not affected” where the vulnerable code never shipped. The Ubuntu CVE page and Debian security tracker both do this, and Ubuntu splits the answer by kernel package: on 20.04 the generic linux package is not affected by Dirty Pipe, but linux-hwe-5.13 needed 5.13.0-35.40~20.04.1.
Commands
Checked against linux-exploit-suggester v1.2, Lynis 3.1.7, audit 4.2.1 (sample rules and manual pages), the uname, os-release and sysctl manual pages and the Linux 7.3 kernel documentation. Run ./linux-exploit-suggester.sh --help on your own copy.
uname -r
uname -v
cat /etc/os-release
./linux-exploit-suggester.sh --uname "<saved uname -a output>"
./linux-exploit-suggester.sh --checksec
sysctl kernel.unprivileged_bpf_disabled kernel.kptr_restrict kernel.dmesg_restrict
sudo lynis audit system
sudo auditctl -a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load
sudo auditctl -a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load
sudo auditctl -a always,exit -F arch=b32 -S execve -F euid=0 -F 'auid>=1000' -F 'auid!=unset' -F key=root-exec
sudo auditctl -a always,exit -F arch=b64 -S execve -F euid=0 -F 'auid>=1000' -F 'auid!=unset' -F key=root-exec- The first three identify the kernel and distribution.
--unameassesses a saved string away from the target;--checkseclists kernel and hardware protections and settings such as unprivileged BPF.sysctlgiven only names reads them.- The
b32twins record 32-bit calls on a 64-bit host, as in the audit project’s sample rules. To keep theauditctlrules, write them withoutsudo auditctland the quotes in a.rulesfile under/etc/audit/rules.d/and runaugenrules --load.
Detection and defence
The strongest control is patching, then rebooting into the fixed kernel; MITRE’s M1051, Update Software is its mitigation for T1068. The kernel’s livepatch documentation notes that users are often reluctant to reboot: a livepatch redirects calls from a vulnerable function to a fixed one in the running kernel, within limits such as patching only functions that can be traced. Canonical’s Ubuntu Livepatch, which Canonical provides with Ubuntu Pro, covers kernel flaws rated high or critical and, in Canonical’s words, is not a replacement for rebooting.
Each hardening setting below is from the kernel’s sysctl documentation. kernel.unprivileged_bpf_disabled at 1 blocks unprivileged bpf() until reboot, and at 2 blocks it but can be changed back; kernels built with BPF_UNPRIV_DEFAULT_OFF start at 2. kernel.kptr_restrict at 1 prints %pK pointers as zeros unless the reader has CAP_SYSLOG, and at 2 for everyone; the default, 0, hashes them. Leaked addresses help an attacker find what address randomisation hides, as the self-protection guide explains. kernel.dmesg_restrict at 1 limits the kernel log to users with CAP_SYSLOG. None of these removes a bug, so test them before rolling out.
Expect little from the exploit itself: the dirtycow.ninja FAQ says Dirty COW leaves nothing abnormal in the logs. MITRE’s Linux analytic for T1068, AN1420 in DET0514, watches what surrounds it: auditd execve records reaching effective uid 0, module loads and unusual access to /proc/kallsyms, with legitimate setuid programs as false positives. Of the auditctl rules above, the first is from the audit project’s 43-module-load.rules sample; the second records every root execution from a user’s login session, each sudo included, so tune it before alerting on it.
Lynis, from CISOfy, audits the host and suggests hardening. At 3.1.7, test KRNL-5830 checks that the system runs the latest installed kernel, and KRNL-6000 compares sysctl values with its profile, which expects kernel.kptr_restrict at 2 and the other two settings at 1. The Lynis: Auditing and Hardening Linux and Unix Hosts course covers reading its report, and the Linux Security Fundamentals: Users, Permissions, SELinux and Firewalls course the controls that limit what a low-privileged foothold can reach.
Where to go next
The Linux Security Fundamentals: Users, Permissions, SELinux and Firewalls course is the next step for hardening. For the wider workflow from first scan to report, see Penetration Testing Field Notes.
This article replaces the KSEC ARK notes first published in 2018.
More from this author
- One capture, three questions2 December, 2026
- Payload channels versus timing channels2 December, 2026
