Why C Is the Exploiter’s Language

Free lesson 1 of 11 from C for Hackers — Pointers, the stack, and your first buffer overflow — smash the stack and win, hands-on in gdb.. No account, no card.

C gives you the memory — and the footguns

C has no seatbelts: you manage memory by hand, and the CPU trusts you completely. That's why the fastest software and the deepest vulnerabilities live in C. Learn how C lays out memory and you learn how exploits are born.

By the end of this course you'll take a vulnerable C program and overwrite its return address to hijack execution — the classic "ret2win" — entirely in your lab with gcc and gdb.

🎯 Your target

ls -la ~/cexploit/
cat ~/cexploit/README.txt
cat ~/cexploit/vuln.c          # read the source — the bug is in here
🎯 Challenge: Open your lab, read vuln.c, and run ./vuln once. What does it ask for, and does it ever call win() on its own?
Show solution
cat ~/cexploit/vuln.c
echo hi | ~/cexploit/vuln      # prints "returned normally (no win)"

win() exists but is never called by main. Your whole job is to reach it anyway — by corrupting the stack.

⚖️ Exploit only the lab binary or software you own. Memory-corruption attacks on others' systems are illegal.

Liked it? 10 more lessons are waiting.

11 lessons · knowledge checks · final exam · verifiable certificate · in-browser Live-Lab

Unlock all courses · CHF 9/month Buy only this course · CHF 19

What's in C for Hackers

Continue in the interactive course reader →