Claude Wrote a Full FreeBSD Remote Kernel RCE with Root Shell CVE-2026-4747
claudefreebsdcve-2026-4747rpcsec_gsskernel rceaicybersecurityexploit developmentvulnerabilitystack buffer overflownfsopen source

Claude Wrote a Full FreeBSD Remote Kernel RCE with Root Shell CVE-2026-4747

On March 26, 2026, a vulnerability (CVE-2026-4747) was published, detailing a stack buffer overflow in FreeBSD's RPCSEC_GSS implementation. This vulnerability, specifically in the packet signature validation routine, allows remote code execution (RCE) without prior authentication. What makes this particular vulnerability stand out is the credit attributed to a security researcher using AI for achieving remote kernel code execution. This marks a significant moment for the Claude FreeBSD RCE capability, demonstrating AI's advanced exploit generation.

Just three days later, on March 29, Claude delivered a working exploit, providing a root shell. It took Claude roughly eight hours from the request to a functional exploit, with about four hours of actual "thinking" time. This demonstrates an AI's capability to not only find a bug but also to exploit it to gain kernel-level access.

Exploiting the Vulnerability: The Role of Missing Mitigations

The vulnerability, a classic CWE-121 stack buffer overflow, resides in FreeBSD's RPCSEC_GSS implementation. When the system validates an incoming RPCSEC_GSS packet, it copies the signature data into a fixed-size stack buffer. There is no bounds checking. If an attacker sends an oversized signature, the data overflows the buffer, corrupting the stack. This fundamental flaw allowed the Claude FreeBSD RCE to proceed.

The critical point is that FreeBSD 14.x, the target environment, lacked several exploit mitigations common in modern operating systems. Notably, Kernel Address Space Layout Randomization (KASLR) was absent, rendering kernel addresses fixed and predictable. Furthermore, stack canaries were not implemented for integer arrays, including the specific int32_t[] buffer that overflowed. This absence meant a canary would not have detected the overflow, which would otherwise prevent its exploitation for RCE.

These missing defenses significantly eased Claude's task. It did not need to bypass KASLR or contend with stack canaries, focusing directly on the overflow and shellcode execution. The absence of these standard protections made the system a prime target for an automated exploit generation system like Claude.

Technical Breakdown of the Claude FreeBSD RCE Exploit

Claude's exploit development process was methodical, involving several distinct stages, mirroring the sophisticated approach of a human expert. The initial challenge was the stack buffer overflow itself, which occurs when the RPCSEC_GSS signature validation routine attempts to copy an oversized signature into a fixed-size stack buffer without proper bounds checking. This leads to corruption of the stack frame, allowing an attacker to overwrite return addresses or other critical data. The AI meticulously analyzed the crash dumps and memory layouts to understand the precise offset required for successful exploitation, a key step in achieving the Claude FreeBSD RCE.

The shellcode exceeded a single packet's capacity. Claude devised a 15-round strategy: first, make kernel memory executable, then write the shellcode 32 bytes at a time across 14 packets. This multi-stage delivery mechanism is a common technique in complex exploits, but its automated generation by an AI highlights a new level of sophistication.

Each overflow hijacked an NFS kernel thread. Claude utilized kernel functions to terminate these threads cleanly, essential for server stability and subsequent exploit rounds. This demonstrated an understanding of system stability and resource management, going beyond mere code execution to ensure a persistent and reliable exploit.

Initial stack offsets were incorrect. Claude employed De Bruijn patterns, analyzed kernel crash dumps (available in the lab setup), and corrected the offsets. This mirrors a human reverse engineer's approach, showcasing the AI's ability to learn from failure and adapt its strategy based on observed system behavior. The precision required for this step is often a significant hurdle for human exploit developers.

NFS threads cannot directly execute userland programs. Claude therefore created a new process and used kernel mechanisms to replace it with /bin/sh, also clearing the necessary flags to enable the transition to user mode. This was a non-trivial step, requiring deep knowledge of FreeBSD's process creation and execution mechanisms. The ability to pivot from kernel execution to a stable userland shell is a hallmark of a complete RCE exploit.

Child processes crashed due to stale debug registers inherited from DDB. Claude traced this issue and cleared the relevant debug register before forking. This level of debugging and problem-solving, identifying and rectifying subtle system state issues, is particularly impressive for an AI. It underscores the comprehensive nature of the Claude FreeBSD RCE development.

Practically, this means any attacker, or in this instance, an AI, with network access to a vulnerable FreeBSD system running NFS with kgssapi.ko loaded, could forge tokens and gain kernel-level RCE. The implications for automated threat generation are profound.

Claude FreeBSD RCE exploit in a server room
Claude FreeBSD RCE exploit in a server room

The Impact: Beyond the CVE

This vulnerability represents a significant milestone. The fact that an AI could develop a full remote kernel RCE, from vulnerability analysis to a working root shell, in a matter of hours, represents a significant shift in exploit development capabilities. The successful Claude FreeBSD RCE exploit serves as a stark warning to the cybersecurity community.

For FreeBSD users and maintainers, patching systems is the immediate and clear imperative. FreeBSD has already issued security patches (refer to FreeBSD Security Advisory FreeBSD-SA-26:08.rpcsec_gss). If immediate patching is not feasible, disabling kgssapi.ko (if RPCSEC_GSS is not required) or restricting NFS access via firewall rules offers temporary mitigation. The deeper impact, however, highlights architectural choices.

The absence of KASLR and stack canaries for integer arrays made this a comparatively easier target. The broader cybersecurity community is analyzing the implications of this Claude FreeBSD RCE event. While some discussions suggest a "death of open source" if AI can so easily find and exploit vulnerabilities, this perspective is likely an overreaction. The real takeaway is the urgent need for more robust security engineering from the ground up. This incident underscores the need for proactive security measures against advanced threats, including those powered by AI.

It also emphasizes the necessity for strong sandboxing when using AI agents for security research or development. If an AI can develop a kernel RCE, the scope of its potential autonomous malicious actions, if unconstrained, becomes a critical consideration. This event demonstrates that AI is becoming a potent force in vulnerability research and exploitation. It can automate complex, multi-stage exploit development that previously required highly skilled human experts. This means the speed of attack development could accelerate dramatically, making the Claude FreeBSD RCE a case study in future threat models.

The Response: Patching, Hardening, and Rethinking OS Design

Applying the latest FreeBSD security patches for CVE-2026-4747 is the immediate and essential step. If immediate patching is not feasible, disabling kgssapi.ko (if RPCSEC_GSS is not required) or restricting NFS access via firewall rules offers temporary mitigation. Furthermore, enhanced monitoring is critical, requiring verbose logging for NFS and RPC services, specifically to identify unexpected crashes, anomalous network traffic on port 2049, or repeated RPCSEC_GSS errors. These immediate actions are crucial to prevent further exploitation, especially by sophisticated tools like the one used for the Claude FreeBSD RCE.

The long-term response to the Claude FreeBSD RCE incident, however, requires a deeper approach. This incident highlights the need for a deeper re-evaluation by operating system developers, particularly those maintaining systems that may lag in modern exploit mitigations. A primary recommendation is to implement Kernel Address Space Layout Randomization (KASLR), a fundamental defense against memory corruption exploits whose absence in FreeBSD 14.x was a significant factor here. Concurrently, stack protections must be strengthened, ensuring stack canaries are in place for all relevant stack buffers, including integer arrays, as a basic defense against stack overflows. Finally, the vulnerability itself underscores the necessity for rigorous code review and fuzzing of complex network protocols like RPCSEC_GSS, especially those handling authentication and signature validation.

Beyond patching this specific vulnerability, we must recognize that the threat landscape has fundamentally shifted. AI can now act as an incredibly efficient, tireless exploit developer. We cannot rely on the hope that attackers will not have access to similar capabilities. It is crucial to build systems that are resilient even when faced with an AI-powered adversary. The architectural gaps that made this RCE possible for Claude are exactly the kind of low-hanging fruit that AI will pick first. These gaps must be eliminated. The lessons learned from the Claude FreeBSD RCE are invaluable for future cybersecurity strategies.

Daniel Marsh
Daniel Marsh
Former SOC analyst turned security writer. Methodical and evidence-driven, breaks down breaches and vulnerabilities with clarity, not drama.