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 to Windows structures that change with each version (sometimes more than once per version).



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! I had originally planned to make the patched driver available to anyone else in my situation, but with all the trouble it takes to get it running it's probably not worth it. Still, this was a valuable experience and I learned a ton.


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