MOCK: Optimizing Kernel Fuzzing Mutation with Context-aware Dependency

Jiacheng Xu, Xuhong Zhang, Shouling Ji, Yuan Tian, Binbin Zhao, Qinying Wang, Peng Cheng, Jiming Chen

Introduction

Kernel fuzzing is a critical technique for identifying vulnerabilities in operating systems by feeding sequences of system calls (syscalls) into the kernel to trigger crashes. However, modern kernels are highly stateful. To reach deep, vulnerable code paths, a fuzzer must generate specific sequences of calls that establish the necessary environment—for example, creating a socket, binding it, and configuring options before data transmission.

Existing state-of-the-art fuzzers like Syzkaller and HEALER often rely on "context-free" dependencies, typically analyzing syscall relationships on a point-to-point basis. This approach fails to capture the long-distance relationships and subtle calling contexts required to trigger complex bugs, often leaving fuzzers stuck in shallow code regions.

System Architecture

MOCK introduces a novel approach to kernel fuzzing by transitioning from context-free mutations to context-aware sequences. The system operates through a three-stage pipeline: Pre-Processing, Input Generation, and Execution/Feedback.

The MOCK system architecture, illustrating the flow from static analysis to context-aware input generation and execution feedback.

1. Context-aware Dependency Learning

To move beyond simple point-to-point dependencies, MOCK utilizes a Neural Network Language Model (NNLM). It collects syscall sequences that trigger new code coverage and applies a minimization algorithm to remove noise, creating a "golden" training set.

The core of this model is a Bidirectional Gated Recurrent Unit (BiGRU). Unlike standard forward-looking models, the BiGRU considers both the "front" context (preceding calls) and the "rear" context (subsequent calls). This allows MOCK to predict the most effective syscall to insert at any given position within a sequence, maintaining logical and semantic consistency.

Architecture of the BiGRU language model used to predict syscall distributions based on surrounding context.

2. Context-aware Mutation and Adaptive Scheduling

During the mutation phase, MOCK queries the trained BiGRU model to obtain a probability distribution of promising syscalls. This ensures that new additions are semantically relevant to the current execution state.

To balance the use of the model with broader exploration, MOCK employs a Multi-Armed Bandit (UCB-1) algorithm. This scheduler dynamically manages the trade-off between exploration (using random or static-based mutations to discover new areas) and exploitation (leveraging the learned model to probe deeper into known functional paths).

Key Results and Impact

Evaluation against Linux kernels 5.4 through 5.19 demonstrated that MOCK significantly outperforms existing tools:

  • Code Coverage: MOCK achieved 7% to 32% higher branch coverage than HEALER and Syzkaller.
  • Efficiency: The system reached target coverage levels 1.32x to 2.23x faster than its competitors.
  • Input Quality: MOCK produced 50% more interrelated sequences, indicating a superior ability to model functional dependencies.
  • Bug Discovery: MOCK identified 39 unique vulnerabilities in a head-to-head comparison on Linux 5.10. Notably, it discovered 5 unique bugs requiring sequences as long as 16 syscalls—depths unreachable by context-free fuzzers.

In real-world testing, MOCK discovered 15 unique bugs in recent kernels, leading to four official fixes and the assignment of two CVEs: CVE-2022-2978 and CVE-2022-40476.

Limitations and Future Work

While MOCK excels at sequential dependencies, it does not yet explicitly model concurrency or race conditions between threads. Additionally, while it optimizes syscall selection, it still relies on traditional methods for generating syscall arguments (pointers, flags, etc.). Future iterations may integrate parameter-aware learning to further enhance the precision of generated test cases.

Summary updated

BibTeX
@inproceedings{xu2024mock,
  author = {Jiacheng Xu and Xuhong Zhang and Shouling Ji and Yuan Tian and Binbin Zhao and Qinying Wang and Peng Cheng and Jiming Chen},
  title = {{MOCK: Optimizing Kernel Fuzzing Mutation with Context-aware Dependency}},
  booktitle = {NDSS},
  year = {2024},
}
Figure