Executive Summary
A new defense evasion technique dubbed "Function Pointer Cache Hijacking" has been identified, targeting the Antimalware Scan Interface (AMSI) and Event Tracing for Windows (ETW) within PowerShell sessions. Developed by researcher Amr Thabet, the method exploits how the .NET Common Language Runtime (CLR) caches native function pointers in writable heap memory. By overwriting these cached pointers using .NET reflection, an attacker can redirect critical security functions to harmless APIs without triggering standard detection mechanisms.
Technically, the attack avoids traditional red flags such as memory patching of DLL code sections or calling `VirtualProtect`, which are frequently monitored by EDR solutions. Instead, it uses pure managed PowerShell code to modify the `MethodDesc` structure in the heap. This allows the attacker to effectively blind AMSI and silence Script Block Logging (EID 4104) and Command Lifecycle logging (EID 7937) while maintaining compatibility with Windows Control Flow Guard (CFG).
This technique represents a significant shift in bypass tradecraft because it operates entirely within the data plane of the .NET runtime. It poses a high risk to organizations relying on PowerShell telemetry for threat hunting, as it can be implemented in as few as 14 lines of code without dropping files to disk or modifying executable memory sections.