Open Anti-Cheat. A kernel-mode anticheat just for fun.
OAC implements several advanced detection vectors.
Detects hypervisors by manipulating memory management (page tables and CR3) in ways that are valid on bare metal but often mishandled by virtualization.
- Implementation:
OAC/cr3_thrasher.c- Minimalist Page Table Creation:
TriggerCr3Thrashcreates a minimal page table hierarchy. - Context Swap: Swaps IDT to a custom one using
__lidt. - CR3 Thrash: Overwrites
CR3with a custom value (__writecr3) to trigger VM-exits. - Deliberate Page Fault: Intentionally triggers a page fault to test exception handling.
- Minimalist Page Table Creation:
- Recovery:
OAC/isr.asm- Page Fault ISR:
PageFaultIsrrestores the originalCR3and resumes execution.
- Page Fault ISR:
Uses Non-Maskable Interrupts (NMIs) to perform high-privilege, out-of-band analysis of system state.
- NMI Callback & Loop:
OAC/stackwalk.cTriggerNmiStackwalkbroadcasts NMIs to all cores.NmiCallbackhandles the interrupt and initiates checks.
- Kernel Stack Unwinding:
OAC/stackwalk.cPerformUnwindInSafeRegionsafely unwinds the stack to find executing code.
- Kernel Module Verification:
OAC/ci.cVerifyModuleSignatureByRipverifies digital signatures of executing code.
- CR3 Validation:
OAC/cr3_validation.cIsCr3InProcessListchecks if the capturedCR3belongs to a valid process.
- Suspicious Page Table Mapping:
OAC/pt_analyzer.cAnalyzeProcessPageTablesdetects user-mode mappings of kernel memory.
Monitors outbound network connections and analyzes the originating thread for in-memory shellcode.
- WFP Callout:
OAC/wfp_monitor.cWfpConnectCalloutintercepts connection attempts atALE_AUTH_CONNECT.
- Thread Analysis:
OAC/shellcode_analyzer.cAnalyzeThreadForShellcodeunwinds the stack of the connecting thread.IsMemoryRwAndContainsSignaturechecks for RWX permissions and shellcode signatures.
- Zydis Integration:
OAC/zyan_stackwalker.c- Uses Zydis for heuristic stack unwinding.
The driver is controlled from a user-mode client via the following IOCTLs:
| Control Code | Hex Value | Description |
|---|---|---|
IOCTL_TEST_COMMUNICATION |
0x800 |
A simple test command to verify that the client and driver can communicate. |
IOCTL_TRIGGER_CR3_THRASH |
0x801 |
Executes the anti-hypervisor CR3 thrashing routine. |
IOCTL_UNLOAD_DRIVER |
0x802 |
Unloads the kernel driver. |
IOCTL_TRIGGER_NMI_STACKWALK |
0x803 |
Triggers the NMI-based system integrity scans (stackwalk, signature check, CR3 validation, etc.). |
IOCTL_INITIALIZE_WFP_MONITOR |
0x804 |
Registers the WFP callouts to begin monitoring outbound network connections. |
IOCTL_DEINITIALIZE_WFP_MONITOR |
0x805 |
De-registers the WFP callouts and cleans up all related filters, stopping network monitoring. |
⚠️ WARNING: This is a kernel-mode driver. Running this code can lead to system instability or Blue Screen of Death (BSOD) errors. It requires disabling fundamental Windows security features. Use this exclusively on a test machine or in a virtual machine.
- Kernel Driver Mapper: A tool is required to map the driver into the kernel. KDMapper is recommended.
- Disable VDBL (Vulnerable Driver BlockList): This security feature must be disabled as it may prevent
kdmapper's vulnerable driver from loading. Instructions here. - Map the driver: Open an administrator command prompt and run
kdmapper_Release.exe OAC.sys. - Run the client: Execute
OAC-Client.exeto interact with the driver and trigger its features via the IOCTL interface.