13.1 — What is reverse engineering?
Working backwards#
So far, you've gone forwards: write C++ → compile → get a program.
Reverse engineering (RE for short) goes backwards. You start with a finished program — with no source code — and work out how it works.
It's like taking apart a clock to see how the gears fit together.
Who does this?#
- Security researchers find bugs in programs before attackers do.
- Malware analysts take apart viruses to learn how to stop them.
- Developers debug crashes in code they don't have the source for, or make old file formats work again.
- CTF players solve reversing puzzles in security competitions — for fun and prizes.
Learning RE also makes you a better C++ programmer. When you see what your code really turns into, pointers, references and classes suddenly make much more sense.
The rules: stay legal and kind#
Reverse engineering is a normal skill, but what you reverse matters.
- ✅ Programs you wrote yourself (that's most of this chapter).
- ✅ Practice programs made to be reversed: crackmes and CTF challenges (13.9 — Where to practise legally).
- ✅ Open-source software, or software whose licence allows it.
- ❌ Cracking paid software, removing copy protection, or cheating in online games.
- ❌ Getting into systems or accounts that aren't yours.
Many software licences forbid RE, and in many countries breaking copy protection is illegal. When in doubt, don't.
What you need to know first#
This chapter uses ideas from earlier chapters. It's best to have finished up to at least chapter 10, especially:
- Functions, parameters and return values (6.2 — Giving back a value (return), 6.3 — Inputs: parameters)
- Memory, addresses and pointers (9.1 — Memory and addresses, 9.4 — Pointers: a note with an address)
- Structs and classes (10.2 — struct: a group of values, 10.3 — Classes: objects with behaviour)
Tip: press ← / → to move between lessons, / to search.