pwndbg utilities and cyclic patterns
pwndbg adds commands around common debugging tasks. Names and flags can vary between releases; use help COMMAND and the official command reference for your installed version.
Protections and environment
Section titled “Protections and environment”checksec # inspect the loaded binaryvmmap # process mappingscanary # locate stack canary values, when present| Command | What it does |
|---|---|
checksec |
Summarizes common protections for the loaded binary. |
vmmap |
Lists mapped regions and permissions in the current process. |
canary |
Searches for stack-protector canary values in the process. It does not prove that the program leaks one. |
checksec --file=./chall can also be run in the shell before launching GDB. A canary command finding a value does not mean an input can leak it; determine whether the program exposes relevant bytes.
Cyclic patterns
Section titled “Cyclic patterns”A cyclic pattern identifies the position of overwritten bytes in a controlled input. Keep the generator’s alphabet and subsequence length consistent between creation and lookup.
cyclic 200 # create a pattern (pwndbg/GDB extension version dependent)cyclic 200 asks the installed extension to generate a 200-character non-repeating subsequence pattern. The command may differ by version; help cyclic shows its syntax. The pwntools version below lets you specify the subsequence length explicitly.
Shell workflow with pwntools, which is explicit about the subsequence length:
from pwn import *
pattern = cyclic(300, n=8) # generate bytesoffset = cyclic_find(0x6161616161616167, n=8)print(offset)For a little-endian value from a 64-bit crash, use the integer shown by the debugger and the same n=8. Alternatively, copy the exact bytes from the saved return slot and pass them to cyclic_find. Confirm the result against the crash; partial overwrites, truncated input, or a different pattern order can mislead.
General discovery
Section titled “General discovery”helphelp telescopeapropos patterntheme # inspect/change pwndbg display themes| Command | What it does |
|---|---|
help |
Lists GDB commands and extensions visible in the current session. |
help telescope |
Shows arguments and usage for pwndbg’s telescope command. |
apropos pattern |
Searches command descriptions for the word “pattern.” |
theme |
Displays or changes pwndbg’s context display theme. |
For current instruction helpers, try nearpc; for pointer-aware memory, try telescope; for mappings, use vmmap. When a command is unavailable, use its GDB counterpart or install the documented pwndbg release for your environment.