KernJC: Automated Vulnerable Environment Generation for Linux Kernel Vulnerabilities
This talk introduces KernJC, a tool designed to automate the generation of vulnerable Linux kernel environments for security research and exploit development. The tool addresses the challenges of reproducing kernel vulnerabilities by automatically identifying the correct kernel version, required build configurations, and necessary dependencies. It streamlines the process of setting up a reproducible environment, enabling researchers to quickly test and verify exploits for specific CVEs. The presentation includes a demonstration of the tool's workflow, from vulnerability profiling to environment deployment.
Automating Linux Kernel Exploit Environments with KernJC
TLDR: Reproducing Linux kernel exploits is often a nightmare of dependency hell, kernel version mismatches, and missing build configurations. KernJC solves this by automating the entire lifecycle of environment generation, from identifying the correct kernel version to configuring and building the target environment. This tool allows researchers to move from a CVE identifier to a functional, debuggable exploit environment in minutes, significantly lowering the barrier for kernel-level security research.
Kernel exploitation remains the gold standard for privilege escalation, yet the friction involved in setting up a reliable test environment often discourages even seasoned researchers. When a new CVE drops, the gap between reading the advisory and having a working PoC is usually filled with hours of manual labor: hunting for the specific vulnerable kernel source, wrestling with kconfig options, and ensuring the build environment matches the target. This manual process is not just slow; it is error-prone. If your build configuration is slightly off, you might be testing against a patched or non-vulnerable kernel without realizing it.
The Problem with Manual Reproduction
Most kernel vulnerabilities are highly sensitive to build-time configurations. A researcher might follow the steps in a blog post to compile a kernel, only to find that the specific feature required to trigger the bug—like a missing NFQUEUE rule in netfilter—is absent because the corresponding kconfig option wasn't enabled. This leads to "false negatives" where a perfectly valid exploit fails, leading the researcher to abandon a viable path.
The research presented at Black Hat 2025 highlights that this is a systemic issue. Many public PoCs and advisories provide incomplete information regarding the necessary build environment. When you cannot reproduce the vulnerability, you cannot verify the exploit, and you certainly cannot develop a reliable patch or detection mechanism.
How KernJC Streamlines the Workflow
KernJC treats the kernel build process as a graph problem. Instead of relying on manual trial and error, the tool profiles the vulnerability by analyzing the patch commit and the associated CVE metadata. It identifies the vulnerable version range and, crucially, maps out the dependencies required to enable the vulnerable code path.
The tool’s workflow is straightforward:
- Vulnerability Profiling: It ingests CVE data and patch commits to understand the vulnerability's requirements.
- Version Identification: It performs patch analysis to confirm which kernel versions are actually vulnerable, filtering out the noise often found in NVD entries.
- Config Identification: It builds a
kconfiggraph to determine the exact set of configurations needed to expose the bug. - Environment Provisioning: It automates the download, configuration, and compilation of the kernel, then deploys it in a QEMU instance.
For a pentester, this means you can run a single command to stand up a target:
./kjc build CVE-2021-22555
./kjc start --enable-kvm
This approach mirrors the ease of use found in container orchestration, but for the much more complex task of kernel-level virtualization. By abstracting the kbuild and kconfig complexity, KernJC allows you to focus on the exploit primitive rather than the infrastructure.
Real-World Applicability
During a red team engagement or a deep-dive security assessment, time is your most limited resource. If you are tasked with testing a privilege escalation chain, you need to know quickly if a target system is vulnerable. KernJC allows you to rapidly spin up a replica of the target kernel environment to test your payloads.
Furthermore, the tool’s ability to identify "hidden" configurations is a game-changer. Many kernel bugs are only reachable when specific, non-default features are enabled. By mining the kconfig graph, KernJC can suggest the necessary flags to enable, ensuring your test environment is a faithful representation of the target. This is particularly useful when auditing systems with custom kernel builds, where standard distributions might not reflect the actual attack surface.
Defensive Implications
From a defensive perspective, the existence of tools like KernJC underscores the importance of kernel hardening. If a researcher can automate the generation of a vulnerable environment, so can an adversary. Defenders should focus on reducing the kernel attack surface by disabling unnecessary subsystems—such as netfilter or ebpf—if they are not required for the system's function.
The OWASP guidance on security misconfiguration applies here: running a kernel with a massive, unneeded feature set is a liability. If you aren't using a feature, compile it out. The more complex your kernel configuration, the larger the graph of potential vulnerabilities you are exposing to an attacker.
Moving Forward
The era of manual kernel environment setup is ending. Tools that automate the "boring" parts of exploit development allow the community to focus on higher-level research, such as finding new primitives or bypasses for modern mitigations like KASLR.
If you are involved in kernel security, stop wasting time on manual builds. Clone the KernJC repository and start building your own library of reproducible environments. The next time you encounter a complex kernel bug, you will be ready to test it in minutes rather than days.
CVEs
Vulnerability Classes
Target Technologies
Attack Techniques
Up Next From This Conference
Similar Talks

Anyone Can Hack IoT: A Beginner's Guide to Hacking Your First IoT Device

Unsaflock: Unlocking Millions of Hotel Locks




