offensive-tools/rev/gdb/SKILL.md
GDB with pwndbg/GEF for dynamic binary analysis, malware debugging, exploit development, and reverse engineering on Linux/WSL. Use when debugging ELF binaries, tracing syscalls, unpacking Linux malware, bypassing anti-debug, or scripting automated analysis with Python.
npx skillsauth add aeondave/malskill gdbInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
GNU debugger enhanced with pwndbg or GEF — the primary dynamic analysis tool for ELF binaries.
# GDB
sudo apt-get install -y gdb
# pwndbg (recommended for RE/malware)
git clone https://github.com/pwndbg/pwndbg ~/pwndbg
cd ~/pwndbg && ./setup.sh
# OR GEF (lighter)
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
# OR portable pwndbg tarball (no git needed)
# Download from https://github.com/pwndbg/pwndbg/releases
tar -xf pwndbg_*.tar.xz
./pwndbg/bin/pwndbg ./binary
# Open binary
gdb -q ./binary
# With pwndbg:
pwndbg> start # Run to main
pwndbg> disass main # Disassemble main
pwndbg> info functions # List all functions
pwndbg> context # Show registers, code, stack, backtrace
| Command | Purpose |
|---------|---------|
| start | Start and break at main |
| starti | Start and break at first instruction |
| run [args] | Run with arguments |
| continue / c | Continue execution |
| nexti / ni | Step over (instruction level) |
| stepi / si | Step into (instruction level) |
| next / n | Step over (source level) |
| finish | Run until current function returns |
| until *ADDR | Run until address |
| Command | Purpose |
|---------|---------|
| break main | Break at function |
| break *0x401234 | Break at address |
| break connect | Break on libc call |
| rbreak regex | Break on all functions matching regex |
| catch syscall ptrace | Catch specific syscall |
| watch *0xADDR | Hardware watchpoint (data bp) |
| info breakpoints | List breakpoints |
| delete N | Delete breakpoint N |
| condition N expr | Conditional breakpoint |
| Command | Purpose |
|---------|---------|
| info registers / regs | All registers |
| x/20gx $rsp | Examine 20 qwords at RSP |
| x/s $rdi | Print string at RDI |
| x/10i $pc | Disassemble 10 instructions at PC |
| telescope $rsp 30 | pwndbg: smart stack dump |
| vmmap | pwndbg: memory map |
| hexdump $rsp 0x80 | pwndbg: hex dump |
| search --string "http" | pwndbg: search memory |
| bt | Backtrace (call stack) |
| info proc mappings | Process memory layout |
| Command | Purpose |
|---------|---------|
| set {int}0xADDR = VALUE | Write to memory |
| set $rax = 0 | Modify register |
| dump binary memory out.bin ADDR1 ADDR2 | Dump memory range to file |
| find /b ADDR1, ADDR2, 0x4d, 0x5a | Find byte pattern |
# Most Linux malware uses ptrace(PTRACE_TRACEME) to detect debuggers
catch syscall ptrace
run
# When caught:
set $rax = 0 # Fake success
continue
# Malware reads TracerPid from /proc/self/status
catch syscall openat
run
# When openat for /proc/self/status is caught, let it proceed
# and break on read to patch the result
# Break when malware changes memory permissions (RWX = unpacked code)
catch syscall mprotect
run
# When hit: check arguments
x/s $rdi # address
p/x $rsi # length
p/x $rdx # prot flags (7 = RWX)
# After mprotect returns, dump the unpacked region:
dump binary memory unpacked.bin $rdi ($rdi + $rsi)
break connect
break send
break recv
break sendto
break getaddrinfo
run
# On hit:
bt # See call chain
x/s $rdi # Examine args
# Trace all calls with arguments
pwndbg> set logging on
pwndbg> break *entry_point
pwndbg> commands
> silent
> bt 1
> continue
> end
pwndbg> run
# GDB Python API — run with: gdb -q -x script.py ./binary
import gdb
class MalwareTracer(gdb.Breakpoint):
def __init__(self, func):
super().__init__(func, gdb.BP_BREAKPOINT)
self.func = func
self.silent = True
def stop(self):
frame = gdb.selected_frame()
rdi = int(frame.read_register("rdi"))
rsi = int(frame.read_register("rsi"))
print(f"[TRACE] {self.func}(rdi=0x{rdi:x}, rsi=0x{rsi:x})")
return False # Don't stop, just log
for f in ["connect", "send", "recv", "write", "execve", "mprotect"]:
try:
MalwareTracer(f)
except Exception:
pass
gdb.execute("run")
| Command | Purpose |
|---------|---------|
| context | Show full context (regs, code, stack, bt) |
| telescope ADDR N | Dereference pointer chains |
| vmmap | Virtual memory map with permissions |
| procinfo | Process details |
| got | GOT table entries |
| plt | PLT entries |
| canary | Show stack canary value |
| retaddr | Return addresses on stack |
| search --string STR | Search memory for string |
| search --qword VAL | Search memory for value |
| patch ADDR 'nop; nop' | Patch instructions |
| heap | Heap chunk listing (glibc) |
| bins | Arena bin contents |
| vis_heap_chunks | Visual heap layout |
| xinfo ADDR | Offset info for address |
| cymbol | Define custom C structs |
| entry | Run to entry point |
| Command | Purpose |
|---------|---------|
| gef config | Configure GEF |
| checksec | Binary security features |
| elf-info | ELF header details |
| xfiles | List all loaded libraries |
| scan | Search for patterns |
| format-string-helper | Format string exploit aid |
| pattern create N | De Bruijn pattern for offset finding |
| pattern offset VAL | Find offset from pattern value |
| File | When to load | |------|--------------| | references/malware-debugging.md | Step-by-step malware debugging workflows | | references/scripting.md | GDB Python API patterns for automation |
data-ai
Scoped routing: Linux operator; hosts, sessions, users, services, packages, logs, containers, SSH, network paths, privilege evidence.
development
Offensive methodology for ICS/OT/SCADA environments in authorized industrial penetration testing and red team operations. Use when assessing PLCs, RTUs, HMIs, engineering workstations, historians, or field devices running Modbus, DNP3, EtherNet/IP, S7comm/S7+, Profinet, IEC 60870-5-104, BACnet, or OPC-UA. Covers passive OT network enumeration, protocol-level device interrogation, PLC coil/register read-write attacks, HMI session exploitation, historian and engineering workstation compromise, and safe escalation rules for critical infrastructure scope. Does not cover: general IT network exploitation (network-technique), physical hardware interfaces UART/JTAG/SPI (hardware-technique), wireless sensor network attacks (wireless-technique), RF/SDR signal analysis (hardware-ctf or wireless-technique), or CTF-framed ICS lab tasks (ics-ctf).
tools
Offensive methodology for authorized game security assessments, game client security research, and game-adjacent penetration testing in real-world engagements. Use when assessing game clients for cheating vulnerabilities, testing anti-cheat effectiveness, auditing game server protocols for score manipulation or economic fraud, reverse engineering game DRM or license validation, analyzing game save file protection, or assessing game mod/plugin security. Covers: process memory scanning and manipulation (Cheat Engine methodology), game binary reversing for license and DRM bypass, game network protocol analysis and packet replay, anti-cheat mechanism analysis, save file format reversing and tampering, speed hack and value injection techniques. Does NOT cover: CTF game challenges (game-ctf), game engine source code auditing (web-exploit-technique or vuln-search-technique for the backend), or general binary exploitation (pwn-ctf or reversing-technique).
development
Auth assessment: hardware/embedded methodology; UART/JTAG/SWD/SPI/I2C, firmware extraction, boot/debug paths, embedded OS evidence.