# Kernel Fuzzing
> Coverage-guided fuzzing of OS kernels, drivers, hypervisor-adjacent code and firmware, where the "input" is a sequence of syscalls, packets, files or device interactions, coverage comes from KCOV or a hypervisor, and reproducibility fights global kernel state.
## How it works
- **Coverage:** Linux KCOV is built for fuzzing. Enable `CONFIG_KCOV`, avoid `KCOV_INSTRUMENT_ALL` (slows and adds noise), and instrument only the subsystem under test — e.g. append `KCOV_INSTRUMENT := y` to every Makefile under `net/` ([[raw/blog.cloudflare.com/a-gentle-introduction-to-linux-kernel-fuzzing-3656|Cloudflare: kernel fuzzing intro]]).
- **Engines:** syzkaller is the standard Linux fuzzer, driven by syzlang descriptions of syscalls and their resources. Cloudflare showed the alternative of driving AFL with a userspace netlink shim whose KCOV coverage is mapped into AFL's bitmap, inside KVM ([[raw/blog.cloudflare.com/a-gentle-introduction-to-linux-kernel-fuzzing-3656|Cloudflare]]). On Windows: WinAFL for kernel-reachable user-mode parsers ([[raw/research.checkpoint.com/denial-of-fuzzing-rust-in-the-windows-kernel-4880|Check Point]]) and wtf for snapshot-based kernel-mode fuzzing ([[raw/offsecblog.com/wtf-snapshot-based-fuzzing-of-windows-user-and-kernel-mode-targets-14698|wtf]]).
- **State is the enemy:** global pools, session tables and namespaces leak across programs, causing irreproducible crashes and false positives. See [[Fuzzing Harness Design]].
## Techniques
### Remote attack surface (network)
xairy extended syzkaller with TUN/TAP packet injection via pseudo-syscalls (`syz_emit_ethernet`, `syz_extract_tcp_res` to learn sequence numbers for TCP), handled checksums, and collected coverage from packet-processing contexts with KCOV remote coverage. No "take over the Internet" bug, but a **one-shot RCE in a non-public kernel flavor** ([[raw/xairy.io/looking-for-rce-bugs-in-the-linux-kernel-3919|xairy: RCE bugs in the Linux kernel]]).
### In-kernel servers: ksmbd
Doyensec's syzkaller work on ksmbd: wrote a grammar for every SMB2 command from MS-SMB2 (e.g. `smb2_ioctl_req`), parsed responses for TreeID/SessionID to chain valid state, enabled durable handles/oplocks/leases to widen surface, patched NTLMv2 auth (guest fallback) and credit limits, raised `max connections = 128` after candidates got rejected, and tried `reset_acc_state` for determinism. **`focus_areas`** weighting (`{"filter": {"functions": ["smb_check_perm_dacl"]}, "weight": 20.0}`) drove an ACL that passed validation into an integer overflow. Output: CVE-2024-26980, CVE-2024-50283/-50285/-50286, and ~20 CVE-2025-2xxxx/-3xxxx ksmbd issues ([[raw/blog.doyensec.com/ksmbd-fuzzing-improvements-and-vulnerability-discovery-4290|Doyensec ksmbd]]).
### net/sched and false positives
Repeated soft lockups (`net_tx_action`, `tc_modify_qdisc`, …) turned out to be syzkaller artifacts: `reset_net_namespace` does not truly reset namespaces, leaving residual state between programs. Fixing the net/sched syzlang descriptions removed the noise; of the bugs found, three were exploitable, including CVE-2025-38001 and CVE-2025-38616, with a kernelCTF payout (and the HangBuzz101 corCTF challenge) ([[raw/willsroot.io/syzkaller-summer-fixing-false-positive-soft-lockups-in-net-sched-3920|willsroot: Syzkaller Summer]]).
### LLM-generated descriptions
KernelGPT generates and iteratively repairs syzkaller specs for drivers/sockets from kernel source: 24 new bugs, 11 CVEs, specs merged upstream (`eval_spec.py` to reuse them) ([[raw/github.com/kernelgpt-enhanced-kernel-fuzzing-via-llms-4289|KernelGPT]]). More on [[LLM-Assisted Fuzzing]].
### Concurrency
- **May-race-pair scheduling:** decouple input generation from interleaving exploration, target "May Race Pairs", LLM-assisted semantic mutation of syscall groups, backpressure thresholds — 187 data races (59 harmful), beating SegFuzz and CONZZER at equal budget ([[raw/arxiv.org/efficient-concurrency-fuzzing-for-linux-kernel-data-race-detection-12822|Concurrency fuzzing for data races]]).
- **MAccConc (Project Zero):** memory-access tracing via KCOV/ASan instrumentation plus stack-based delay injection to confirm race candidates, write regression tests and explore interleavings, with TUI/GUI ([[raw/projectzero.google/testing-race-conditions-with-memory-access-tracing-and-stack-based-del-11978|P0 MAccConc]]).
- **Schedule shuffling:** deterministic VMs like Rewind VM switch threads at `rewind_point()`s; even a `counter++` race loses updates in 18 of 20 interleavings ([[raw/fzakaria.com/why-does-shuffling-the-schedule-find-so-many-bugs-13466|Why shuffling the schedule finds bugs]]).
### Windows
Check Point fuzzed EMF+ metafiles through GDI with WinAFL/WinAFL Pet; mutations kept bugchecking the host — a "denial of fuzzing" — traced (via memory dumps, Volatility/MemProcFS, and a client-server setup that stores each mutated file before it runs) to a bug in the new **Rust** kernel GDI component, fixed in OS Build 26100.4202 (KB5058499) ([[raw/research.checkpoint.com/denial-of-fuzzing-rust-in-the-windows-kernel-4880|Check Point: Denial of Fuzzing]]). WinPE booted from RAM in QEMU makes a fast idempotent driver-test VM ([[raw/bednars.me/winpe-as-a-stateless-harness-for-windows-driver-testing-and-fuzzing-9935|WinPE harness]]).
### macOS / XNU
Casco's XNU harness (one decision per task, maximal determinism, isolated VMs, automatic PoC generation to prove reachability) produced 141 findings and 17 reports incl. CVE-2026-112524, -65350, -112507 ([[raw/casco.com/building-an-xnu-bug-hunting-harness-141-findings-17-reports-14110|Casco XNU harness]]).
### Firmware and multi-component targets
- **Metis** rehosts EDK2 UEFI protocols in userspace (direct-dependency component rehosting) with LLM-guided harness synthesis: 73.1% coverage on 60 drivers, 137 new bugs (12 remotely triggerable), beating FuzzUEr ([[raw/arxiv.org/towards-effective-fuzzing-of-edk2-components-metis-13290|Metis]]).
- **MTCFuzz** combines coverage from OS *and* firmware (OpenSBI) under QEMU ([[raw/arxiv.org/multi-target-coverage-based-greybox-fuzzer-3655|MTCFuzz]]).
- **Unicorn snapshot fuzzing** of embedded daemons (Siemens PROFINET DCP) — see [[Fuzzing Harness Design]] ([[raw/nozominetworks.com/fuzzing-siemens-profinet-dcp-with-unicorn-afl-14270|Nozomi]]).
## Notable cases
- ksmbd CVE series (Doyensec); CVE-2025-38001/-38616 net/sched (willsroot); Rust GDI bugcheck (Check Point); XNU CVE trio (Casco); KernelGPT's 11 CVEs.
- Contrast: Microsoft FORGE's MDASH used LLM code scanning (not fuzzing) on Linux subsystems for 59 upstream reports and 33 CVEs, heavily filtered by experts ([[raw/microsoft.com/microsoft-lessons-from-59-linux-kernel-bug-reports-14955|Microsoft: 59 kernel reports]]).
## Related
- [[Fuzzing]]
- [[Coverage-Guided Fuzzing]]
- [[Fuzzing Harness Design]]
- [[Grammar-Based Fuzzing]]
- [[LLM-Assisted Fuzzing]]
## Sources
- [[raw/blog.cloudflare.com/a-gentle-introduction-to-linux-kernel-fuzzing-3656|A Gentle Introduction to Linux Kernel Fuzzing]]
- [[raw/xairy.io/looking-for-rce-bugs-in-the-linux-kernel-3919|Looking for RCE Bugs in the Linux Kernel]]
- [[raw/blog.doyensec.com/ksmbd-fuzzing-improvements-and-vulnerability-discovery-4290|ksmbd: Fuzzing Improvements and Vulnerability Discovery]]
- [[raw/willsroot.io/syzkaller-summer-fixing-false-positive-soft-lockups-in-net-sched-3920|Syzkaller Summer: Fixing False Positive Soft Lockups in net/sched]]
- [[raw/github.com/kernelgpt-enhanced-kernel-fuzzing-via-llms-4289|KernelGPT: Enhanced Kernel Fuzzing via LLMs]]
- [[raw/arxiv.org/efficient-concurrency-fuzzing-for-linux-kernel-data-race-detection-12822|Efficient concurrency fuzzing for Linux kernel data race detection]]
- [[raw/projectzero.google/testing-race-conditions-with-memory-access-tracing-and-stack-based-del-11978|Testing race conditions with memory access tracing and stack-based delay injection]]
- [[raw/fzakaria.com/why-does-shuffling-the-schedule-find-so-many-bugs-13466|Why does shuffling the schedule find so many bugs?]]
- [[raw/research.checkpoint.com/denial-of-fuzzing-rust-in-the-windows-kernel-4880|Denial of Fuzzing: Rust in the Windows kernel]]
- [[raw/offsecblog.com/wtf-snapshot-based-fuzzing-of-windows-user-and-kernel-mode-targets-14698|wtf: snapshot-based fuzzing of Windows user- and kernel-mode targets]]
- [[raw/bednars.me/winpe-as-a-stateless-harness-for-windows-driver-testing-and-fuzzing-9935|WinPE as a stateless harness for Windows driver testing and fuzzing]]
- [[raw/casco.com/building-an-xnu-bug-hunting-harness-141-findings-17-reports-14110|Building an XNU bug-hunting harness: 141 findings, 17 reports]]
- [[raw/arxiv.org/towards-effective-fuzzing-of-edk2-components-metis-13290|Towards Effective Fuzzing of EDK2 Components (Metis)]]
- [[raw/arxiv.org/multi-target-coverage-based-greybox-fuzzer-3655|Multi-target Coverage-based Greybox Fuzzer]]
- [[raw/nozominetworks.com/fuzzing-siemens-profinet-dcp-with-unicorn-afl-14270|Fuzzing Siemens PROFINET DCP with Unicorn-AFL]]
- [[raw/microsoft.com/microsoft-lessons-from-59-linux-kernel-bug-reports-14955|Microsoft: Lessons from 59 Linux kernel bug reports]]