A minimal CR3 protection proof-of-concept (PoC) for implementing CR3 protection in the Windows kernel by hooking the KdpTrap
function.
The driver overwrites a portion of the KdpTrap
function to redirect execution to our custom handler.
Before handling the CR3 register, the PoC inspects the name of the current process (cheatengine-x8
). If it matches a target process, the CR3 modification is rejected.
When a CR3 write instruction (mov cr3, ...
) is encountered:
- Identify the instruction using its opcode.
- Check the source operand for the new CR3 value.
- Decide whether to allow or override the new CR3 based on the process.
- Apply the final CR3 value to the process.
- Windows Version Compatibility: Offsets for
KdpTrap
vary by OS build. Update the hooking offset to match your os version. - PG: Might break on future versions of Windows.
https://github.com/SamuelTulach/HookGuard
This code is provided as-is for educational and research purposes. Hooking kernel functions can cause system instability and may violate software license agreements. Use at your own risk.