Back to Skills

code-obfuscation-deobfuscation

Code obfuscation analysis and deobfuscation playbook. Use when reversing binaries protected by junk code, opaque predicates, self-modifying code, control flow flattening, VM protection, or string encryption.

1,268stars174forksUpdated 7/2/2026

Security Assessment

Safe(100/100)
Security Score100/100

About code-obfuscation-deobfuscation

An expert playbook for identifying, classifying, and defeating code obfuscation in native binaries. It targets binaries hardened with junk code, opaque predicates, self-modifying code, control-flow flattening, the movfuscator, VM protectors such as VMProtect, Themida, and Code Virtualizer, string encryption, import hiding, and anti-disassembly tricks, and it explicitly separates obfuscation from packing and static from dynamic deobfuscation strategies, distinctions that base models tend to blur.

A quick-identification table maps what an analyst sees in IDA or Ghidra to the likely technique and a starting point: a flat CFG with one giant switch points to control-flow flattening, recovered with symbolic execution; a function of only `mov` instructions points to the movfuscator, handled with demovfuscation or trace-based lifting; a pushad/pushfd sequence into a VM entry points to a VM protector, addressed by extracting the handler table; and an XOR loop before execution points to self-modifying code or string encryption, broken by dynamic analysis after decode.

Each technique then gets its own section with identification signs and concrete removal or recovery strategies, illustrated with runnable snippets: Z3 to prove an opaque predicate is constant, Unicorn to emulate and dump self-modified code, and angr to symbolically deflatten a dispatcher by finding the highest in-degree block and solving for each case's real successor. Control-flow flattening recovery is compared across angr, Triton, miasm, trace-based tooling, and the D-810 IDA plugin, and VM protection is broken down from entry-point identification through handler-table extraction to devirtualization. Cross-references route to related skills for anti-debugging layers, symbolic-execution tooling, and deep VM bytecode analysis when a binary combines multiple protections.

FAQ

When should I use this skill?

When reversing native binaries protected by junk code, opaque predicates, self-modifying code, control-flow flattening, VM protection, or string encryption.

How do I quickly identify the obfuscation type?

A symptom table maps IDA or Ghidra observations to techniques, for example a flat CFG with a single giant switch indicates control-flow flattening and a function containing only `mov` instructions indicates the movfuscator.

What tools does it recommend for control-flow flattening?

Symbolic execution with angr, Triton, or miasm, trace-based recovery with Pin or DynamoRIO, pattern matching with custom scripts, and the D-810 IDA plugin designed specifically for CFF.

How are opaque predicates defeated?

Through abstract interpretation, symbolic execution with Z3 to prove the condition is constant, pattern matching known families, or dynamically observing that the branch is never or always taken.

How do I handle self-modifying code?

Identify the decryption routine, which is often an XOR, ADD, or SUB loop writing to `.text`, set a breakpoint after the loop, dump the decrypted region, and re-analyze it, or automate unpacking with Unicorn emulation.

Install code-obfuscation-deobfuscation

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill