Kernel driver demonstrating ObRegisterCallbacks for process handle access stripping, the same core mechanism used by BattlEye, EasyAntiCheat, Vanguard, and FACEIT AC to protect game processes.
The driver intercepts every usermode OpenProcess / DuplicateHandle targeting Target.exe and strips:
| Access Right | Hex | Effect |
|---|---|---|
PROCESS_VM_READ |
0x0010 | Blocks ReadProcessMemory |
PROCESS_VM_WRITE |
0x0020 | Blocks WriteProcessMemory |
PROCESS_VM_OPERATION |
0x0008 | Blocks VirtualAllocEx / VirtualProtectEx |
PROCESS_TERMINATE |
0x0001 | Blocks TerminateProcess |
kernel-process-protect/
├── driver/ Kernel driver (ObCallbackDemo.sys)
├── target/ Protected process (Target.exe)
├── verifier/ Tests if protection works (Verifier.exe)
└── README.md
- driver/: Empty WDM Driver project in Visual Studio + WDK. Requires
/integritychecklinker flag and test signing. - target/ and verifier/: Console applications.
cl.exe /Fe:Target.exe Target.c
bcdedit /set testsigning on
sc create ObCallbackDemo type=kernel binPath="C:\path\to\ObCallbackDemo.sys"
sc start ObCallbackDemo
Target.exe (launch from explorer)
Verifier.exe <PID> <address> (from PowerShell, should fail with Access Denied)
sc stop ObCallbackDemo
sc delete ObCallbackDemo
This is a proof of concept. The whitelisted process approach (csrss, explorer, cmd, conhost) is trivially bypassable by injecting into any whitelisted process and opening the handle from there.
Real anti-cheats layer additional defenses on top of ObRegisterCallbacks:
- Protect whitelisted processes too with additional ObRegisterCallbacks registrations so you can't inject into them
- Monitor DLL loading via
PsSetLoadImageNotifyRoutineto detect injection - Monitor thread creation via
PsSetCreateThreadNotifyRoutineto catchCreateRemoteThreadinto whitelisted processes - Stack walking on the callback to verify the caller isn't shellcode running inside a legitimate process
- Boot-time loading (Vanguard) to control the entire chain before anything else runs
These layered defenses are what make the difference between a demo and a production anti-cheat. The arms race between cheat developers and anti-cheat engineers is about stacking and bypassing these layers.