As security engineers increasingly depend on kernel-level telemetry to validate the integrity of running processes, a new breed of attack known as LACUNA has emerged to subvert the fundamental trust placed in call-stack analysis. Developed by security researcher Mohamed Alzhrani, this framework represents a sophisticated pivot in the ongoing arms race between malware authors and Endpoint Detection and Response (EDR) vendors. For years, the industry shifted away from easily bypassable user-mode “hooking” toward deeper kernel-mode monitoring, believing that the call stack provided an immutable record of execution history. However, the LACUNA attack chain demonstrates that this “source of truth” is far more malleable than previously assumed, particularly when exploiting the inherent architectural design of the Windows operating system. By targeting the gaps in how function unwinding is handled, attackers can now weave malicious instructions into a tapestry of seemingly legitimate system calls, rendering traditional EDR visibility blind to the true nature of the threat. This method effectively turns the Windows kernel’s own internal logic against the very security tools designed to protect it.
Technical Foundation: Mechanism of Architectural Exploitation
The Discovery: Exploitability of Windows Function Unwinding
The core of this research centers on the process of function unwinding, specifically how Windows handles the RtlVirtualUnwind function when traversing the stack. During execution, the system relies on the .pdata section of an executable to map out how to return from functions and restore registers. Researchers discovered that within common Windows libraries like ntdll.dll, there are significant address ranges—dubbed “lacunae”—that exist between legitimate entries in this metadata table. When an EDR’s stack walker encounters an instruction pointer located within one of these gaps, the system fails to find a corresponding entry and defaults to treating the code as a “leaf function.” This architectural oversight allows the system to advance the stack pointer without any further validation or error.
By chaining these gaps together, the LACUNA framework allows an attacker to construct a forged stack trace that appears to be composed entirely of signed, legitimate system modules. This represents an evolutionary leap over earlier techniques like HookChain, which were primarily concerned with circumventing user-mode hooks. While modern security products have moved to the kernel level using Event Tracing for Windows (ETW-Ti) to capture call stacks at the moment of a system call, LACUNA ensures that the telemetry captured by these sensors is indistinguishable from standard, benign system activity. With thousands of these gaps identified in critical files, the framework offers a nearly limitless library of “ghost functions” that can be used to mirror legitimate API returns and bypass module-of-origin checks.
Evolution: Overcoming Kernel-Level Visibility Limits
The shift toward kernel-level monitoring was intended to make shellcode visible by capturing the full context of a thread’s execution history. When a sensitive system call is initiated, the kernel-mode monitor performs a stack walk to verify that the call originated from a trusted source rather than a rogue memory region. LACUNA defeats this mechanism by ensuring that the malicious code never appears on the stack during the brief window when the security sensor is active. By populating the stack with pointers to these newly discovered lacunae, the attacker creates a perfect illusion of legitimacy. This is particularly effective because the stack walker, finding no reason to doubt the metadata-less “leaf functions,” continues its traversal until it reaches the trusted base of the thread.
This technique is remarkably resilient because it does not rely on traditional obfuscation or encryption to hide the malware’s presence. Instead, it utilizes the “voids” of the operating system itself—segments of memory that are officially part of trusted files but lack the specific metadata required for deep inspection. By inhabiting these voids, malicious threads can execute complex sequences of system calls while the EDR remains focused on a forged history of execution. This discovery highlights a fundamental vulnerability in the structural integrity of call stacks as a security metric. As long as the operating system permits the execution of code within these unmapped gaps, the “ground truth” of a thread’s intent remains hidden from even the most advanced kernel-mode defensive technologies.
Strategic Implementation: Operational Components and Impact
Framework Logic: Managing Telemetry and Execution Flows
To successfully implement this bypass, the LACUNA framework employs a suite of seven distinct components designed to manage every aspect of the execution lifecycle. One of the most critical elements is the “ETW-Ti APC Window Attack,” which targets the specific timing of stack telemetry collection. This component ensures that the malicious stack is only swapped with the forged chain when the target thread is in a non-alertable state, effectively blinding the kernel-mode sensor at the exact moment it attempts to record the call stack. This level of synchronization prevents the EDR from seeing the real malicious instructions, leaving only the clean, forged trace in the logs. Furthermore, the “BYOUD-MF” component provides the necessary tools for arbitrary stack pointer manipulation, allowing for seamless transitions between real and spoofed data.
Additional layers of protection are provided through the use of Vectored Exception Handlers (VEH) and parameter encryption. By encrypting sensitive system call arguments and only decrypting them at the last possible microsecond through a hardware breakpoint, the framework ensures that memory scanners cannot detect the intent of the API call even if they manage to intercept the arguments. This multi-layered approach creates a situation where the EDR is monitoring a purely theatrical performance. The execution flow, the return addresses, and even the parameters of the system calls are all carefully curated to meet the expectations of the security product’s whitelist, while the actual malicious payload operates in a separate, unmonitored logical dimension of the process.
Defensive Reassessment: Behavioral Correlation and Testing
Rigorous testing of this attack chain against modern Windows 11 environments has revealed the significant challenges facing current defense-in-depth strategies. Even when systems were equipped with hardware-backed protections like Control-flow Enforcement Technology (CET) and industry-leading EDR solutions, the LACUNA framework successfully bypassed stack-based detection. While some security products were able to trigger secondary alerts based on behavioral anomalies, such as unusual handle access or suspicious memory permission changes, none were capable of identifying the shellcode through stack inspection alone. This confirms that the industry’s reliance on structural telemetry must be reconsidered, as the very metadata used to validate execution can be bypassed using the operating system’s own architectural gaps.
The emergence of such techniques necessitates a move away from simple structural validation and toward more complex, multi-factor behavioral correlation. Defenders can no longer rely on a “clean” stack trace as a guarantee of a thread’s safety; instead, they must look for patterns of activity that deviate from established baselines across multiple telemetry streams. While this shift toward holistic monitoring is essential for countering LACUNA-style attacks, it also introduces the risk of increased false positives and requires a more intensive tuning process for security operations centers. The struggle to secure the operating system now involves monitoring not just what is present in the code, but also how attackers inhabit the empty spaces left behind by the architecture of the system itself.
Future Considerations for Endpoint Security
The discovery of these structural vulnerabilities within the Windows function unwinding process necessitated a fundamental shift in how security teams approached threat detection. Organizations moved away from the assumption that kernel-level visibility was an absolute safeguard and began investing in more robust behavioral analysis that tracked the intent of a process rather than its historical stack trace. Security architects realized that while a stack could be spoofed, the underlying side effects of malicious activity—such as unexpected network connections or lateral movement attempts—remained much harder to falsify. Consequently, the industry pivoted toward integrating hardware-level telemetry with advanced machine learning models to identify the subtle discrepancies that occur when a thread’s reported state does not match its actual behavior.
The lessons learned from the LACUNA research prompted software developers and operating system vendors to focus on closing the metadata gaps in critical system libraries. This led to a widespread effort to ensure that every address range within a signed DLL was properly accounted for in the .pdata section, effectively eliminating the “leaf function” default that attackers exploited. Defenders also began utilizing more aggressive stack validation techniques that checked for the presence of forged frames by analyzing the timing and frequency of system calls. By combining these structural hardening measures with a more skeptical approach to telemetry, the security community worked toward a more resilient posture that acknowledged the inherent malleability of the operating system’s internal structures and focused on the broader context of execution.


