Software Protection and Reverse Engineering: Techniques, Tools, and Defense
🛡️ Software Protection and Reverse Engineering
Protecting software against piracy, overuse, and reverse engineering is a critical aspect of cybersecurity. This blog post walks through software protection mechanisms, the EXE packing process, and how reverse engineers unpack and analyze protected binaries using tools like x64dbg, Scylla, and more.
🚨 What is Software Protection?
Software protection involves preventing unauthorized use or analysis of applications. Common methods include
- Anti debugging: Preventing analysis by debuggers.
- EXE packing: Compressing and obfuscating executables.
- Runtime encryption and code virtualization.
📦 What is EXE Packing?
EXE packing refers to compressing or protecting executables by
- Reducing file size
- Preventing reverse engineering
- Obfuscating original code
In reversing, both packers and protectors are commonly called packers.
Popular Packers
UPXArmadilloVMProtectAsProtect
🎯 Purpose of EXE Packing
- Prevent software cracking (license key bypass, serial patching)
- Defeat static and dynamic analysis
- Reduce distribution file size
💥 How Reverse Engineers Defeat Software Protection
🔓 Unpacking
Let the software decompress in memory, then dump the original EXE from RAM and patch it.
🛠️ Using Loaders
A loader attaches to the packed EXE, waits for unpacking in memory, then patches the running process without modifying the original binary.
🧩 What is Unpacking?
Unpacking = Extracting the original binary from a packed EXE.
Techniques
- Live debugging using x64dbg or OllyDbg
- Automatic unpackers (for simple packers only)
🕵️♂️ Detecting Packers
🔍 Tools
PEiD,DIEautomatic packer detectionPEview,PE Editoranalyze PE header manually
📁 Structure of a Packed EXE
| Before Packing | After Packing |
|---|---|
| Original code | Compressed/encrypted shell |
| Normal headers | Obfuscated headers |
| Full import table | Stub loader with hidden IAT |
🔢 Types of Packers
| Type | Description | Example |
|---|---|---|
| I | Single unpacking routine, simple | UPX |
| II | Multi layer unpacking | ASPack |
| III | Non linear unpacking with loops | ASProtect |
| IV | Interleaved unpacking & code | ACProtect |
| V | Fragmented frame based unpacking | Beria |
| VI | Fragment unpacking on demand | Armadillo 8.0 |
| VII | Instruction virtualization | VMProtect, Themida |
🧠 Execution Flow of a Packed EXE
- Starts at new OEP
- Saves registers:
PUSHADorPUSH EBP - Unpacks sections in memory
- Resolves Import Address Table (IAT)
- Restores registers:
POPADorPOP EBP - Jumps to original entry point
Instruction Breakdown
1PUSHAD ; pushes EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
2POPAD ; pops them back🪛 Unpacking Standard Process
- Debug to find the real OEP
- Dump the binary at OEP
- Fix the Import Table (IAT)
- Patch the PE Header
🐞 Unpacking with x64dbg
- Load EXE in
x64dbg - Trace until
PUSHADorPUSH EBP - Set hardware breakpoint on
EBPin stack - Press
F9to continue - Break after
POPADorPOP EBP - Trace until
JMP OEP - Dump EXE with Scylla plugin
- Fix IAT
🔧 Anti Debugging Plugins
Use plugins like:
ScyllaHideSharpOD
These bypass anti debugging checks in software and allow reverse engineering even when protections are in place.
🎓 Conclusion
Software protection is a cat and mouse game between developers and attackers. Understanding how EXE packing works, and how it can be reversed using tools like x64dbg, Scylla, and PEview, equips you with valuable insight into defensive software engineering and reverse engineering.