Skill v1.0.0
currentLLM-judged scan90/100name: kernel-exploit-basics description: Use when learning kernel exploitation fundamentals in a lab with your own vulnerable VMs. Covers kernel attack surface, common bug classes, SMEP/SMAP/KASLR bypass concepts, and safe lab practices. Also use when triaging whether a kernel bug is exploitable. version: 1.0.0 domain: binary lifecycle: stable last_verified: 2026-10-23 requires: [] extends: [] relates: [pwn-fundamentals, heap-exploitation, rop-chains] tools:
- name: Python
version: 3.12
- name: Ghidra
version: 11.3
Kernel exploitation turns a kernel bug into ring 0 code execution: the stakes and the mitigations are both higher than userspace. This skill covers the fundamentals for lab learning on your own VMs: attack surface, bug classes, mitigation concepts, and the safe lab setup. Learning only; never test kernels you do not own.
Quick Workflow
- Build the lab: a vulnerable kernel VM with snapshots, and a
matching debug setup.
- Learn the attack surface: syscalls, ioctls, and drivers reachable
from unprivileged users.
- Study the bug class: UAF, overflow, or race in kernel context.
- Understand the mitigations: SMEP, SMAP, KASLR, KPTI, and what
each stops.
- Plan the primitive: what the bug gives you (read, write, where).
- Plan the escalation: from primitive to credential overwrite or
modprobe_path.
- Develop against snapshots: snapshot before each attempt.
- Document the full chain for learning, with the mitigations
noted.
1. Lab setup and recon
# Lab VM: vulnerable kernel, snapshot before you start# Check the mitigations on your lab kernelcat /proc/cmdlinedmesg | grep -i -E "smep|smap|kaslr" | head -5# Find reachable attack surface: world accessible device nodesfind /dev -type c 2>/dev/null | head -20ls -l /dev/vuln* 2>/dev/null
# Identify the bug: dmesg after a crash tells you the classdmesg | tail -30# KASAN builds give precise reports; use a KASAN kernel for learning
2. Classic escalation primitives (lab)
# Concept: overwrite creds (uid=0) or modprobe_path, then trigger# Modern path: ROP in kernel, bypassing SMEP with ret2usr alternatives# or SMAP bypass via controlled kernel memory writesecho "learn each mitigation bypass separately before chaining"
#!/usr/bin/env python3"""Lab notes template for a kernel bug."""bug = {"location": "driver ioctl 0x1337","class": "heap UAF","primitive": "write-what-where (limited)","mitigations": "SMEP on, SMAP on, KASLR on","plan": "1. defeat KASLR via info leak 2. ROP to commit_creds(prepare_kernel_cred(0))",}for k, v in bug.items():print(f"{k}: {v}")
Edge cases
- The bug is not reachable unprivileged. Then it is a lower
severity local issue; adjust the learning goal.
- KASLR defeats your hardcoded addresses. Learn info leaks first;
guessing is not a method.
- The VM keeps crashing. That is the process; snapshots make it
cheap, and each crash teaches the constraint.
Escalation
- Stuck on a mitigation: study that mitigation's known bypasses
in isolation before returning to the chain.
- Need a real target assessment: kernel exploitation against
production is specialized work; scope it separately.
Detection and defender view
Defenders detect kernel exploitation with kernel integrity monitoring, audit of privileged operations, and crash analysis. They defend with the mitigations (keep them on), timely patching, and reducing attack surface (unneeded drivers, unprivileged namespaces). The durable lesson: patch quickly, because public kernel exploits follow disclosure fast.
Key references
- MITRE ATT&CK T1068 (Exploitation for Privilege Escalation).
- Linux kernel self protection documentation.
- Kernel exploitation learning resources (lab focused).