Unpacking
Defeat obfuscation.
Unpacking is a free Ethical Hacking Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ethical Hacking Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Packing?
Packing compresses or encrypts a program's real code and wraps it in a small stub. At runtime the stub unpacks the original code into memory and runs it.
Malware authors use packing to evade signatures and frustrate static analysis.
Why Unpack?
A packed binary shows few strings, few imports, and high entropy. The meaningful code is hidden until the stub runs.
Unpacking recovers the original code so you can analyze it statically and extract real IOCs.
Detecting a Packer
Tools like Detect It Easy (DIE) and PEiD identify known packers by signature. High entropy and a tiny import table are also strong clues.
Common packers include UPX, ASPack, and Themida.
die sample.exe
# Packer: UPX(3.96)Unpacking UPX
UPX is a common, non-malicious packer that can be reversed with its own tool. The -d flag decompresses the binary back to its original form.
Many real-world samples use UPX or a slightly modified UPX, so this is a frequent first attempt.
upx -d sample.exeManual Unpacking: The Idea
Custom packers cannot be undone with a tool. Instead you let the stub unpack itself in memory, then capture the result.
The plan: run the sample under a debugger, stop right after unpacking completes, and dump the now-revealed code.
Finding the OEP
The Original Entry Point (OEP) is where execution jumps once unpacking finishes. Reaching the OEP means the real code is now in memory.
Techniques to find it include watching for a far jump out of the stub, or setting a breakpoint on memory the stub writes then executes.
Breakpoints for Unpacking
A common trick is a hardware breakpoint on the stack (the stub often restores registers right before jumping to the OEP), or a breakpoint on common API calls the unpacked code uses.
When the breakpoint hits at the OEP, the original code is fully decoded.
Dumping the Process
At the OEP, dump the process memory to a new file. Tools like Scylla (built into x64dbg) or PE-sieve capture the unpacked image.
The dump now contains the real instructions, but it may not run on its own yet.
Rebuilding Imports
After dumping, the Import Address Table is often broken because the packer resolved imports at runtime. Scylla can rebuild the IAT so the dumped file is analyzable.
Once imports are fixed, you can load the clean dump into Ghidra or IDA.
Other Obfuscation
Beyond packing, malware uses other obfuscation: encrypted strings decoded at runtime, junk instructions, control-flow flattening, and anti-debugging checks.
These are defeated case by case, often by combining dynamic tracing with patient static reading.
Verifying the Unpacked Sample
After dumping and rebuilding imports, confirm success by re-running static analysis: you should now see many more strings and a populated import table.
If entropy is back to normal and APIs are visible, the unpack worked and the real code is ready to analyze.
Quick Check
Recall what the OEP signifies during manual unpacking.
Recap
You now understand unpacking:
- Packing hides the real code; detect it with DIE/PEiD, high entropy, and few imports.
- Known packers like UPX unpack with a tool (
upx -d). - For custom packers, run under a debugger, find the OEP, dump with Scylla, and rebuild imports.
- Other obfuscation (encrypted strings, anti-debug) is handled case by case.
You have completed the Reverse Engineering Malware course.
Frequently asked questions
Is the “Unpacking” lesson free?
Yes — the full text of “Unpacking” is free to read here on the web, and the Ethical Hacking Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ethical Hacking Academy course, upgrade to CoddyKit PRO.
What will I learn in “Unpacking”?
Defeat obfuscation. You practise Ethical Hacking Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Ethical Hacking Academy?
No prior experience is required. Ethical Hacking Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Unpacking” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Ethical Hacking Academy lesson?
Yes. Every Ethical Hacking Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.