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.

Black & White Path
Black & White Path
Black & White Path
How to Install pwndbg on WSL2 – A Step‑by‑Step Beginner’s Guide

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

WSL2 + Ubuntu environment diagram
WSL2 + Ubuntu environment diagram

3. Installation steps

Step 1: Update packages

sudo apt update && sudo apt upgrade -y

Updating prevents compatibility issues caused by outdated libraries.

Step 2: Install dependencies

sudo apt install -y git gdb python3 python3-pip curl wget build-essential

This 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/pwndbg

The repository is downloaded into a newly created pwndbg directory.

Step 4: Run the setup script

cd pwndbg
./setup.sh

The 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-packages

Verification

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 checksec

5. 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 pwntools

Verify with gdb and check for pwndbg messages

After completing these steps, you have a ready‑to‑use debugging environment for binary exploitation research.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

GDBUbuntuWSL2pwntoolsbinary exploitationchecksecpwndbg
Black & White Path
Written by

Black & White Path

We are the beacon of the cyber world, a stepping stone on the road to security.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.