Skip to content

About

Hands-on Linux binary exploitation labs: stack/heap overflows, UAF, tcache poisoning, format strings, type confusion, and ROP. Complete with C/C++ source, pwntools exploits, and detailed writeups.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🛡️ Linux Exploit Development & Binary Exploitation Labs

Repo Deep Dive

Welcome to my Binary Exploitation and Vulnerability Research portfolio. This repository contains 10 self-contained, practical labs demonstrating offensive security techniques against modern Linux environments (x86/i386).

Each directory includes the vulnerable C/C++ source code, compilation instructions, a detailed README.md explaining the vulnerability mechanics, and a fully automated Python exploitation script (exploit.py / pwn).

💡 Want the deep technical breakdown? If you want to understand exactly how these exploits work under the hood — including historical context, step-by-step mechanics, memory diagrams, and the specific technical hurdles ("The Stuck") you have to bypass — check out README-MORE.md. It explains every lab from the ground up (ELI5 style).

1

🛠️ Prerequisites & Installation

To compile and run these exploits, you need a Linux environment (Ubuntu/Debian/WSL2 recommended) with 32-bit architecture support, Python 3, and essential debugging tools.

1. System Packages (Apt)

Install the C/C++ compilers (with 32-bit libraries), debugger, and network tools:

sudo apt update
sudo apt install -y build-essential gcc-multilib g++-multilib gdb socat netcat-openbsd python3 python3-pip git

2. Python Dependencies (Pip)

Install pwntools, the industry-standard framework used in all the exploit.py scripts:

pip3 install --upgrade pwntools

(Note: If you are on a newer Debian/Ubuntu system, you may need to use a virtual environment or pip3 install --break-system-packages pwntools)

3. GDB Plugins (GEF)

Install GEF (GDB Enhanced Features), which is heavily used in the walkthroughs to find offsets and inspect memory:

bash -c "$(curl -fsSL https://gef.blah.cat/sh)"

🚀 Getting Started

Clone the repository to explore the labs locally:

git clone https://github.com/ishanoshada/Linux-Exploit-Development.git
cd Linux-Exploit-Development

📂 Lab Directory

Lab Directory Vulnerability Class CWE Exploit Primitive / Technique
stack-buffer-overflow Stack Buffer Overflow CWE-121 Ret2libc, ASLR bypass via /proc/self/maps
format-string Format String CWE-134 %s memory leak, %hn GOT overwrite
use-after-free Use-After-Free (UAF) CWE-416 Tcache LIFO reuse, function pointer hijack
integer-overflow Integer Overflow CWE-190 32-bit multiplication wrap, heap overflow to RCE
command-injection OS Command Injection CWE-78 Shell metacharacter bypass to spawn /bin/sh
heap-overflow Heap Buffer Overflow CWE-122 Adjacent chunk overflow, system() hijack
type-confusion Type Confusion (C++) CWE-843 Object layout mismatch, arbitrary function call
oob-read Out-of-Bounds Read CWE-125 Heartbleed-style leak (defeat ASLR) + OOB Write
off-by-one Off-by-One CWE-193 Null byte overwrite, Stack PC hijack
tcache-poison Tcache Poisoning CWE-416 glibc Safe-Linking bypass, arbitrary malloc()

🛠️ Compilation & Environment

All labs are built and tested on Linux (i386). To ensure the vulnerabilities are reproducible and not mitigated by modern compiler protections, they are typically compiled with:

# Standard build for most labs
gcc -m32 -g -fno-stack-protector -no-pie -z norelro <source.c> -o <binary>

(Exception: The C++ lab requires g++-multilib and is compiled with g++)

🌐 Remote Exploitation (Socat)

To simulate a remote network service for the local exploits, most labs can be wrapped using socat:

socat TCP-LISTEN:9090,reuseaddr,fork EXEC:./vulnerable_binary

🐍 Exploitation Stack

  • Language: Python 3
  • Framework: pwntools
  • Debugger: GDB with GEF
  • Target OS: Ubuntu / Debian (x86 architecture)

⚖️ Disclaimer

Educational Purposes Only. The source code in this repository is intentionally vulnerable. Do not deploy these binaries in production or on any network reachable by untrusted users. The techniques demonstrated here are for authorized security testing, vulnerability research, and defensive engineering.


Credit: Ishan Oshada

About

Hands-on Linux binary exploitation labs: stack/heap overflows, UAF, tcache poisoning, format strings, type confusion, and ROP. Complete with C/C++ source, pwntools exploits, and detailed writeups.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages