You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A pwndbg-style debugger for Windows userland, built from scratch on the Windows Debug API.
pwnWinDbg brings the UX and workflow of pwndbg to Windows — color-coded context display, GDB-style commands, pointer chain analysis, ROP gadget search, and exploit development utilities, all in a native Windows CLI.
Features
Userland
pwndbg-style context — registers, disassembly, stack, and backtrace in a single view
GDB-compatible commands — x/, si, ni, bp, set, finish, etc.
ROP gadget finder — backward scan from ret instructions across executable regions
De Bruijn cyclic patterns — generate and look up offsets for exploit development
Memory search — find strings, hex patterns, pointers, raw bytes across all regions
PE analysis — checksec (ASLR, DEP, CFG, SEH...), IAT dump, section info
Address expressions — use rax+0x10, ntdll+0x1000, rsp-8 anywhere an address is expected
Persistent breakpoints — survive re-run and re-attach
WoW64 support — debug 32-bit processes on 64-bit Windows
Kernel mode (x64)
QEMU GDB stub transport — connect to a Windows VM running under QEMU/KVM with -s/-gdb tcp:...
Process / thread / token enumeration — walks PsActiveProcessHead and EPROCESS.ThreadListHead to list processes, threads and tokens (PID, PPID, name, EPROCESS, Token, DTB)
Token stealing primitive — kdtoken steal <src> <dst> patches EPROCESS.Token to elevate a target process; kdtoken shellcode emits a self-contained x64 stealer
Dynamic struct offset extraction — disassembles stable nt!Ps* exports (PsGetProcessId, PsGetProcessImageFileName, PsGetCurrentProcessId, PsGetCurrentThreadId) at runtime to recover EPROCESS / KTHREAD / ETHREAD field offsets, no per-build hardcoded tables
Kernel lm — list loaded drivers via PsLoadedModuleList, with name/regex filter
Kernel breakpoints, single-step, register dump, mem read/write via the GDB RSP backend
Kernel checksec — reports SMEP / SMAP / NX / KPTI / kernel CET / KVA shadow status from CR0/CR4/EFER
Requirements
Windows 10/11 (x64)
Python 3.10+
Installation
git clone https://github.com/heazzy/pwnWinDbg.git
cd pwnWinDbg
pip install -r requirements.txt
Usage
Userland
# Launch a process
python -m pwnwindbg target.exe
python -m pwnwindbg target.exe --args "arg1 arg2"
python -m pwnwindbg target.exe --stdin payload.bin
# Attach to a running process
python -m pwnwindbg --attach <pid># Or use the wrapper
python main.py target.exe
Kernel debugging (QEMU GDB stub only — for now)
Status: Only the QEMU GDB stub transport is implemented and tested today.
The KDNET (UDP) and named-pipe (kdcom) backends listed in the help are stubs and do not work yet.
Boot a Windows VM under QEMU/KVM with the GDB stub enabled:
qemu-system-x86_64 \
-m 4G -smp 2 -enable-kvm \
-drive file=win10.qcow2,if=virtio \
-s # equivalent to: -gdb tcp::1234# ...or pick your own port:# -gdb tcp::10000
Then attach pwnWinDbg from the host:
python -m pwnwindbg
pwnWinDbg> kdconnect gdb:localhost:10000
pwnWinDbg> lm # list loaded drivers
pwnWinDbg> kdps # walk processes
pwnWinDbg> kdthreads 4 # threads of System
pwnWinDbg> kdtoken # list tokens
pwnWinDbg> kdtoken steal 4 1234 # copy SYSTEM token to PID 1234
pwnWinDbg> kdpte 0xfffff80206ea3000 # walk page tables
pwnWinDbg> kddt _EPROCESS # show struct layout
pwnWinDbg> kdc # continue
pwnWinDbg> kddisconnect
Physical-memory reads (used by kdpte) require QEMU's monitor to be reachable
on the same TCP socket — pwnWinDbg multiplexes xp /Nbx requests over the
QEMU GDB RSP qRcmd channel, so no extra -monitor flag is needed.
Commands
Execution
Command
Aliases
Description
run <exe> [args]
r
Spawn a process
attach <pid>
Attach to a running process
continue
c
Resume execution
si
s
Step into (single instruction)
ni
n
Step over
finish
fin
Run until current function returns
nextcall
nc
Step until next call
nextret
nr
Step until next ret
nextjmp
nj
Step until next branch
entry
Break at PE entry point
kill
Terminate the process
detach
Detach from the process
Breakpoints
Command
Aliases
Description
bp <addr>
b, break
Set a breakpoint
bl
i b, info breakpoints
List breakpoints
bd <id>
del, delete
Delete a breakpoint
retbreak
rb
Break on all ret in current function
Display
Command
Aliases
Description
context
ctx
Full pwndbg-style context
regs
registers
Show registers (highlights changes)
disasm [addr] [n]
u, disass
Disassemble instructions
hexdump <addr> [len]
hd
Classic hex dump
stack [count]
Telescope-style stack view
telescope [addr] [depth]
tel
Pointer chain dereferencing
Memory Examination (GDB-style)
Command
Description
x/bx <addr> [n]
Read bytes
x/wx <addr> [n]
Read dwords
x/gx <addr> [n]
Read qwords
x/s <addr>
Read string
x/i <addr> [n]
Disassemble
Memory Search
Command
Description
search -s "string"
Search ASCII string
search -x "4141"
Search hex pattern
search -p <addr>
Search pointer value
search -b "\x90\x90"
Search raw bytes
Patching
Command
Description
patch <addr> <hex>
Write hex bytes
patch <addr> nop <n>
Write NOP sled
set <reg> <value>
Set register value
set *(type*)addr = val
GDB-style memory write
write <type> <addr> <val>
Write typed value (byte/word/dword/qword/string)
dump <addr> <size> [file]
Dump memory to file
Exploit Development
Command
Description
cyclic <len>
Generate De Bruijn pattern
cyclic -l <value>
Find pattern offset
rop [--module M]
Find ROP gadgets
p2p <src> <tgt>
Find pointers from source into target region
Information
Command
Aliases
Description
vmmap
info maps
Memory map with protections
modules
info modules
List loaded modules
info functions [filter]
funcs
List exports/imports
info proc
Process info
checksec [path]
PE security mitigations
iat [path]
got
Import Address Table
xinfo <addr>
Detailed address info
distance <a> <b>
Offset between two addresses
Kernel Debugging
Currently only kdconnect gdb:host:port is functional. The net: and pipe: forms are placeholders.
Connection / control
Command
Description
kdconnect gdb:host:port
Connect to a QEMU GDB stub (e.g. gdb:localhost:10000)
kddisconnect
Disconnect from the kernel target
kdversion
Target version, build number (from KUSER_SHARED_DATA), bitness
kdbreak
Interrupt a running kernel
kdc / kdcontinue
Resume kernel execution
kdsi / kdstep
Single-step (step into)
kdni
Step over (skip call)
Memory / registers / breakpoints
Command
Description
kdregs
Show kernel registers (with telescope)
kdmem <addr> [size]
Hex dump of kernel memory
kdwrite <addr> <hex>
Write kernel memory
kddisasm [addr] [n] / kdu
Disassemble kernel code
kdbp <addr> / kdbpd <addr>
Set / clear kernel breakpoint
kddbgprint
Show captured DbgPrint output
kdchecksec / checksec
SMEP / SMAP / NX / KPTI / CET / KVA-shadow status
Modules / processes / tokens
Command
Description
lm / kdlm [m] [filter]
List loaded drivers (PsLoadedModuleList)
kdps [filter]
Walk ActiveProcessLinks, list processes
kdthreads <pid|name>
List threads of a process
kdtoken
List process tokens (raw EX_FAST_REF + addr + refcnt)