Pwndamentals

Stack Exploitation

7 challenges

Challenges

CHALLENGE 01

Return to Win

— solves

The classic stack buffer overflow. Overwrite the saved return address with win(), and it reads the flag for you.

CHALLENGE 02

Return to Shellcode

— solves

The stack is executable and the program prints the address of your buffer. Write shellcode into the buffer, overflow the saved return address, and jump back to the buffer to run it.

CHALLENGE 03

Return to Text

— solves

The win() function is back but is now "more secure." Return into the middle of win_authed() to skip its check.

CHALLENGE 04

Integer Overflow

— solves

The bounds check uses a signed int, but fread() takes a size_t. A negative count slips past the check, then turns huge when the read happens.

CHALLENGE 05

Partial Overwrite

— solves

You only control the low byte of the saved return address. PIE is on, but that byte is still enough to land in win().

CHALLENGE 06

Canary Bypass

— solves

The stack canary blocks a straight overwrite, so leak it first and put it back before you return into win().

CHALLENGE 07

Off-by-One

— solves

A single byte past the buffer is enough when it lands on the low byte of the saved frame pointer. Let leave; ret do the rest.