How to Install pwndbg on WSL2 – A Step‑by‑Step Beginner’s Guide
This guide walks you through setting up a binary‑exploitation debugging environment on Windows 11 with WSL2 by installing GDB, the pwndbg plugin, pwntools, and optionally checksec, providing all required commands, verification steps, and troubleshooting tips.
pwndbg is a GDB enhancement plugin that adds color‑coded registers, stack, disassembly, and source views, making binary‑exploitation debugging far more readable than plain GDB.
1. What is pwndbg
It extends the GNU Debugger (GDB) with visual aids tailored for vulnerability research and exploit development.
2. Environment preparation
Windows 11 with WSL2 enabled
Ubuntu 24.04 running inside WSL2
VS Code with the WSL extension for remote development
3. Installation steps
Step 1: Update packages
sudo apt update && sudo apt upgrade -yUpdating prevents compatibility issues caused by outdated libraries.
Step 2: Install dependencies
sudo apt install -y git gdb python3 python3-pip curl wget build-essentialThis command installs git, GDB, Python 3, pip, curl, wget, and the build tools; it takes about two minutes.
Step 3: Clone the pwndbg repository
git clone https://github.com/pwndbg/pwndbgThe repository is downloaded into a newly created pwndbg directory.
Step 4: Run the setup script
cd pwndbg
./setup.shThe script installs all required Python dependencies and integrates pwndbg into GDB. It may run for a while; wait until it finishes.
Step 5: Install pwntools
pwntools is a Python library for writing exploit scripts. pip3 install pwntools If you are on Ubuntu 23 or newer and encounter an "external environment" error, use:
pip3 install pwntools --break-system-packagesVerification
Confirm the GDB version: gdb --version Typical output: GNU gdb (Ubuntu 15.1-1ubuntu1~24.04.1) 15.1 Start GDB on any binary: gdb ./any_binary If pwndbg loaded correctly, the bottom of the startup output shows messages such as:
pwndbg: loaded 194 pwndbg commands.
pwndbg: created 11 GDB functions.Seeing these lines confirms a successful installation.
4. Bonus: Install checksec
checksec reports security mitigations (ASLR, NX, stack canary, PIE) of a binary.
sudo apt install -y checksec5. Summary of steps
sudo apt update && sudo apt upgrade -y sudo apt install -y git gdb python3 python3-pip curl wget build-essential git clone https://github.com/pwndbg/pwndbg cd pwndbg && ./setup.sh pip3 install pwntoolsVerify with gdb and check for pwndbg messages
After completing these steps, you have a ready‑to‑use debugging environment for binary exploitation research.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Black & White Path
We are the beacon of the cyber world, a stepping stone on the road to security.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
