Binary Exploitation 101 - Introduction
This blog series is still a work in progress. The content may change without notice.
Introduction
Four years ago, I came across a book called Hacking: The Art of Exploitation by Jon Erickson1. Since then, I’ve really gotten into binary exploitation and have learned a great deal. I’m still a newbie in many ways, but I think I’ve grown a lot compared to when I first opened that book.
It’s a fantastic book. Starting from the basics of C programming, it goes on to cover binaries, networking, cryptography, and explains both attack and defense techniques. It gave me ideas and insights into how programs actually work, how they can be exploited and defended, and most importantly, it showed me the art and joy of hacking.
The only drawback of the book is its age. The basics of how programs work haven’t changed, and classic techniques like stack overflows, format string attacks, and ret2libc are still valuable to learn. However, the book does not cover many modern defenses and attacks such as stack canaries, CFI, ROP, and heap exploitation.
That’s why I decided to start writing a 2025 edition of Hacking: The Art of Exploitation. I’m not very knowledgeable about networking or cryptography, so I won’t be covering those. Instead, this series will focus specifically on binary exploitation.
I got into binary exploitation because the techniques showed me how programs really work. For example, to understand stack overflows and GOT overwrites, you need to know how function calls and shared libraries work. To bypass defenses like NX bit, ASLR, and CFI, you also need to understand how these protections are actually implemented. For me, studying attacks has always been a way of learning the underlying mechanisms.
That’s the approach I want to keep in this series. Rather than simply introducing attacks and defenses, the goal is to use them as a lens to understand how programs work, and to explore the principles and ideas behind both attack and defense. Wherever possible, I’ll include source code and explain how it works. Understanding these mechanisms is essential not only for developing new attacks that can bypass existing defenses, but also for designing realistic and fundamental mitigations. Through this series, I hope readers will gain a solid understanding of program internals, exploitation strategies, defense techniques, and how to read and reason about source code.
This series will focus on x64 Linux environments. I’ll assume some basic knowledge of computer architecture and the ability to read and write simple C and Python programs. But I’ll explain as much as I can along the way, so even if you’re missing some background, you should be fine. And if you have questions, please don’t hesitate to ask. The only thing I ask is not to just say “I don’t understand.” Tell me how you thought about it, what you tried, and where exactly you got stuck. Identifying what you don’t understand helps clarify which knowledge is missing and makes it easier to get useful feedback.
Finally, because of the subject matter, I need to add a boring but necessary disclaimer. The purpose of this series is to share knowledge, not to train criminals. Attacking someone else’s computer is illegal. What you do with the knowledge you gain here is your own responsibility, and I take no liability for it. Freedom comes with responsibility. Don’t forget that. I sincerely hope you’ll use what you learn here to make the world a “better” place.
My hope is that, just like I was four years ago, some readers will become interested in binary exploitation through this series, gain a deeper understanding of how programs work, learn to think about both attack and defense, and eventually design practical and fundamental solutions that balance the trade-offs. That’s the kind of hacker I want to become myself, and the kind I hope you will become too.
Contents (Planned)
Attacks
- Stack Overflow
- Shellcode
- Format String Attack
- GOT Overwrite
- ROP
- ret2dlresolve
- glibc Heap Exploitation
Defenses
- NX Bit
- Stack Canary
- RELRO
- PIE
- ASLR
- CFI
- Sanitizers
Contributing
As I mentioned at the beginning, I’m only four years into this field, and still very much a newbie. Binary exploitation is a hobby for me, not my job. I’ll do my best to make sure the content is accurate, but I may sometimes make mistakes or fail to explain things in depth due to my own limitations. On top of that, English is not my native language.
Writing a 2025 edition of Hacking: The Art of Exploitation is not something I can do alone. That’s why I’d love your help. Please don’t hesitate to point out mistakes or share feedback on the content. My goal is to reflect everything I’ve learned and experienced so far in this series. I don’t know when it will be complete, but if you’re willing to stick around and support it patiently, I’d be very happy.
Erickson, J. (2021). Hacking: The Art of Exploitation, 2nd Edition. O’Reilly Media. ↩︎