Debugging and Patching Kernel Drivers

21 Mar 2026

Labs 10-1 and 10-3 from Practical Malware Analysis include drivers which must be copied to C:\Windows\System32. The original drivers were 32-bit and written for Windows XP. Since XP is practically unusable at this point, new 64-bit drivers written for Windows 7 were made available on the PMA GitHub repo. This is again starting to become a problem because I encountered difficulties finding a Windows 7 VM image and the Lab10-03.sys driver crashes on Windows 10. I discovered the source of this problem is hard-coded offsets used as pointers to Windows structures that change with each version (sometimes more than once per version).

No Starch Press has given me permission to distribute the patched version of the Lab 10-03 driver which can be downloaded here. WARNING: DO NOT INSTALL THIS DRIVER ON YOUR HOST SYSTEM. These samples are intended to be run in sandbox VMs. This particular driver only hides the process making calls to it, but it's still a bad idea to install anything designed to imitate malware. The archive password is "malware".



Fixing the Lab10-03.sys Driver:

  1. Debugging the Crash
  2. Patching the Driver



Conclusion

The hard-coded values in the original driver for Lab10-03 made it difficult to complete this lab initially. Fortunately this gave me the opportunity to get some practice with WinDbg to actually debug and patch a kernel driver. This was a valuable learning experience that taught me even more about Windows internals than the lab intended. I look forward to diving even deeper into researching Windows internals like Driver Signature Enforcement in the future.


Feedback is welcome and encouraged! Please leave a comment below: