Reverse engineering: taking things apart to build them better

I spent years building software before I got serious about how you take it apart. That was the wrong order.
When you write code, you think in features: what the program should do, and how. When you take a program apart, you think in surfaces: where to get in, what to sidestep, which single value you have to change for everything else to give way. Those are two different trades, and the second one makes you much better at the first.
Here is what I learned by learning to open executables — and what it changed in the way I build my own.
Understand the attacker to build the defence
That is the founding principle of offensive security: you only protect properly what you have already known how to break. Understanding exactly how someone dissects an executable, sidesteps a validation, or intercepts a network packet changes how you design your own systems.
When I architect a platform — React, TypeScript, a realtime database — knowing where a malicious script or a forged request will try to slip in makes me secure the code at the root rather than patch it later. That is the move from development to genuine DevSecOps, and the difference is not cosmetic: it shows up in the architecture, not in a list of fixes.
Three fields to explore
Application and web security. OWASP Top 10 territory: actively exploiting injection flaws, API misconfigurations and weak authentication — in order to fix them properly. A background in software architecture is a real head start here, because you already know where developers cut corners.
Reverse engineering. Pulling malware apart, understanding how ransomware encrypts a disk, auditing the obscure firmware of a control board in electric equipment or machinery. This is where my past in industrial robotics and telecom pays off most: software wired into real hardware is ground I know.
Hardware and radio. Auditing Sub-GHz protocols, NFC, badge emulation, keystroke injection. The whole physical dimension of security — the one you forget when you only think in software.
The toolbox
- Structure analyser — Detect It Easy (DIE): dissects the PE header, identifies the compiler, spots packers and obfuscation signatures. Always the first tool you open.
- .NET decompiler — dnSpyEx or ILSpy: turns MSIL bytecode back into readable C#.
- Disassembler — Ghidra or IDA Pro: analyses native assembly, builds control-flow graphs, decompiles C and C++.
- Debugger — x64dbg or WinDbg: step-by-step execution, breakpoints, live inspection of registers and memory.
- Network analyser — Wireshark or HTTP Toolkit: intercepting and decoding HTTP/HTTPS traffic and raw TCP/UDP streams.
The four phases
1. Static analysis. You study the file at rest. You pull the visible strings, look at the imported functions — which system APIs does this program call? — and map the logical blocks. Nothing runs, so nothing is triggered.
2. Dynamic analysis. In a controlled environment, under a debugger. You watch the real behaviour: registers changing, system calls, temporary files, connection attempts. This is often where the program says out loud what its code was hiding.
3. Working around protections. Against mutation-based obfuscation, anti-debug routines or code virtualisation, the source is no longer directly readable. You have to find the detection routines before you can move at all.
4. The tipping point. This is the most useful lesson for a developer, and the least comfortable: breaking a complex algorithm is rarely necessary. A single logical flag — one conditional jump, one boolean function — usually carries the whole weight of the decision. The entire protection rests on one line. If that sounds familiar, go and look at your own authorisation code.
Reading an analysis report
Four things to look at when DIE hands you its verdict:
Architecture. PE32 or PE64: 32-bit or 64-bit. The simplest fact on the screen, and it frames everything else.
Compiler. If it says .NET, the program is C# or VB.NET and decompiles almost completely. Microsoft Visual C/C++ or Delphi means native code — considerably longer to read. PyInstaller or Electron means Python or wrapped web code, often the easiest of the three.
Protector. VMProtect, Themida, Enigma, UPX: the code has been compressed or encrypted. If that field shows nothing but the linker, the file is probably in the clear.
Entropy. A measure of disorder in the file. A normal binary sits between 4 and 6. Close to 8 and it is heavily encrypted or obfuscated — and you already know it will be a long evening.
When the binary is genuinely armoured
Sometimes a report stacks every protection at once. I ran into a textbook case: a .NET application — in principle very readable — buried under several aggressive layers.
- Obfuscation. The code has been through a blender: no readable
CheckLicense(), just variables renamed to random characters and fake arithmetic added purely to lose the reader. - Virtualisation. The toughest of them. The original code is turned into a custom instruction set, run by a virtual machine embedded inside the program itself.
- Anti-analysis. The software detects that it is being watched and deliberately sabotages itself.
- Packing. The core is compressed and encrypted. The real code never exists in the clear on disk; it only unfolds in memory, at runtime.
Open that in a decompiler and you will not find a hollow shell with a few plaintext HTTP calls. You find a wall.
That is a lesson in itself. Someone invested seriously in making their work unreadable — and that deserves respect, even when it is in your way.
What this changes for my clients
I do not sell offensive security as a service. I made it a habit instead.
In practice: I never put an authorisation decision in the client. I assume everything shipped to the browser is readable and editable, because I know which tools people read it with. I check what my own keys expose before publishing them, not after. And when I choose where to store a piece of data, my first question is what a curious stranger would see if they pulled on the thread.
That is not paranoia, it is economics. A flaw fixed at architecture time costs a conversation. The same flaw fixed afterwards costs a reputation.