windows-kernel-debugging
windows-kernel-debugging copied to clipboard
A guide to get you started with Windows Kernel Debugging walking you through the complete setup and usage of WinDbg to trace Windows process creation at the kernel level, from boot to PspCreateProcess...
FREE Reverse Engineering Self-Study Course HERE
Windows Kernel Debugging
A guide to get you started with Windows Kernel Debugging walking you through the complete setup and usage of WinDbg to trace Windows process creation at the kernel level, from boot to PspCreateProcess, using VMware Workstation.
π§° Environment Overview
Host Machine
- Windows OS (any version)
- WinDbg Preview (from Microsoft Store)
- VMware Workstation
Guest VM
- Windows 10 x64
- Configured for COM-based kernel debugging via named pipe
βοΈ Configure the Guest VM
-
Shut down the VM
-
Add Serial Port in VMware:
- VM Settings β Add β Serial Port
- Output to named pipe
- Pipe name:
\\.\pipe\com1 - This end is the server β
- The other end is an application β
-
Enable Kernel Debugging in Guest OS: Open Command Prompt as Administrator inside the VM and run:
bcdedit /debug onbcdedit /dbgsettings serial debugport:1 baudrate:115200
-
Reboot the VM
π§ Launch WinDbg on Host
- Run WinDbg as Administrator (on the host machine)
- Go to
File β Kernel Debug β COM - Set the following:
- Port:
\\.\pipe\com1 - Baud:
115200 - Pipe: β
- Reconnect: β
- Break on Connection: optional
- Resets:
0
- Port:
Click OK. WinDbg will say:
Waiting to reconnect...
π¦ Establish the Debug Connection
- Reboot the guest VM.
- WinDbg on the host should automatically connect:
Connected to target Windows 10...Kernel Debugger connection established.
- Load symbols:
.reload /f
π― Trace Process Creation
- Set a breakpoint on process creation:
bp nt!PspCreateProcessgto continue
-
Inside the VM, launch a user-mode process (e.g.
notepad.exe) -
WinDbg will pause in
PspCreateProcessβ the kernel is actively creating a newEPROCESS.
π Inspect Process Internals
- Dump the current process:
!process 0 0- Check image name:
dx ((nt!_EPROCESS*) @rcx)->ImageFileName- View call stack:
k- View command line:
- Inspect
RSPβ extract_RTL_USER_PROCESS_PARAMETERS
π§ͺ Troubleshooting Tips
-
WinDbg wonβt connect:
-
Ensure VM pipe and debugger port match (
\\.\pipe\com1) -
Verify bcdedit settings inside the guest
-
Reboot VM with WinDbg already listening
-
VM hangs on boot:
-
Kernel is paused β type
gin WinDbg to continue -
Symbols donβt resolve:
-
Use
.symfixfollowed by.reload /f
π§ Extras
- Add breakpoints to
PspCreateThread,NtCreateUserProcess - Use
!handle,!token, or!objectfor kernel object insight - Explore
EPROCESS.ActiveProcessLinksfor the full process list