Skip to content

Day 3: Introduction to GDB, Assembly, and pwndbg

GDB: The GNU Debugger

GDB is a powerful tool for debugging and analyzing programs. It allows you to step through code, examine memory, and inspect registers. Mastering GDB is crucial for reverse engineering, understanding program flow, and identifying vulnerabilities.

Assembly Language

Assembly language is a low-level programming language that directly corresponds to machine code instructions. Understanding assembly is crucial for binary exploitation, as vulnerabilities are often more apparent at this level.

pwndbg: A GDB Enhancement

pwndbg is a plugin for GDB that provides additional features specifically tailored for exploit development, such as enhanced memory views, context-sensitive information, and convenience commands for analyzing binaries.

Theory

GDB Basics

Objective: Learn how to use basic GDB commands.

GDB Tutorial: Read Here

GDB allows you to set breakpoints, watch variables, step through code line-by-line, and inspect the state of your program. Understanding these basics is the first step in debugging and analyzing binaries.

Introduction to Assembly Language

Objective: Learn the basics of x86 assembly language.

x86 Assembly Guide: Read Here

Assembly language reveals the instructions that the CPU executes, providing insights into how high-level code translates into machine operations. This knowledge is essential for understanding how exploits work at the lowest levels.

Practice

Hands-On Exercise

Install GDB and pwndbg: Install GDB and the pwndbg plugin on your system. This setup will be used throughout your binary exploitation journey. Debug a simple program: Use GDB to step through a simple C program and examine its assembly code. Practice setting breakpoints, stepping through instructions, and examining register values. Disassemble Functions: Use GDB to disassemble functions in a binary and analyze their assembly instructions. Identify function prologues, epilogues, and control flow.