/devirtualizing-vm-protected-code
Recover the original logic from code protected by a virtualization obfuscator — VMProtect, Themida/WinLicense, Code Virtualizer, or a custom opcode VM — by locating the VM dispatcher, reverse-engineering the handlers into semantics, extracting the virtual bytecode, and lifting
Claude Code
$ npx -y skills add trilwu/secskills --skill devirtualizing-vm-protected-code --agent claude-code
Codex
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a codex -y
Cursor
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a cursor -y
Gemini CLI
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a gemini-cli -y
GitHub Copilot
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a github-copilot -y
OpenCode
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a opencode -y
Windsurf
$ npx skills add trilwu/secskills --skill devirtualizing-vm-protected-code -a windsurf -y
SKILL.md
devirtualizing-vm-protected-code.SKILL.mdname: devirtualizing-vm-protected-code
description: Recover the original logic from code protected by a virtualization obfuscator — VMProtect, Themida/WinLicense, Code Virtualizer, or a custom opcode VM — by locating the VM dispatcher, reverse-engineering the handlers into semantics, extracting the virtual bytecode, and lifting it to a simplified IR with Triton, miasm, or VTIL-based tools. Use when a function became a giant fetch-decode-dispatch loop, when analysis shows a handler table instead of normal code, or after unpacking reveals a virtualized core.
verified: 2026-08-07
Devirtualizing VM-Protected Code
Virtualization obfuscation replaces native instructions with bytecode for a custom virtual machine embedded in the binary, then runs that bytecode through an interpreter. The original logic is not gone — it is expressed in an instruction set you have to recover first. Devirtualization is a fixed pipeline: find the VM, understand its handlers, extract the bytecode, and lift it back to something readable. The obfuscator changes every build, so the pipeline, not any one tool, is the durable skill.
When to Use
- A function turned into a large `fetch-decode-dispatch` loop with a handler
table instead of ordinary control flow
- Binaries protected by VMProtect, Themida/WinLicense, Oreans Code Virtualizer,
or a bespoke opcode VM
- Recovering the algorithm inside a virtualized function (a licence check, a
crypto routine, anti-cheat logic)
- After unpacking, when the real code is virtualized rather than merely packed
When NOT to Use
- **Unpacking, dumping, and fixing imports** of a packed/protected binary — that
is `unpacking-protected-binaries`, and it comes *first*: unpack the outer protection, then devirtualize the virtualized core it reveals.
- **Ordinary (non-virtualized) obfuscation** — junk code, opaque predicates,
string encryption — is normal work for `analyzing-binaries`.
- **Virtualized/obfuscated JavaScript** — `reversing-obfuscated-javascript`.
- **Exploiting a bug** in the recovered logic — `exploiting-memory-corruption`.
The Pipeline
**1. Locate the VM.** Find the transition from native to virtual: the `vm_enter` stub that saves native context and sets up the virtual machine, the dispatcher loop that fetches the next virtual opcode and jumps through a handler table, and the `vm_exit` that restores native context. The dispatcher is the anchor for everything else.
**2. Recover the VM architecture.** Identify the **virtual context** — the structure holding the VM's registers and virtual instruction pointer — and how the dispatcher decodes an opcode into a handler index. Note the VM's shape: stack-based vs register-based, opcode encoding, and any key/rolling obfuscation on the bytecode pointer.
**3. Understand the handlers.** Each handler implements one virtual instruction — a micro-operation like add, load, store, xor, push, or a native call. Analyze handlers individually; **symbolic execution of a single handler** (Triton, miasm) yields its semantics far faster than reading it by hand, because a handler is small and side-effect-focused even when the surrounding VM is huge. Build a table mapping opcode → semantics.
**4. Extract the bytecode.** With the handlers understood, read the virtual instruction stream the dispatcher walks — the actual program, in the VM's instruction set.
**5. Lift and simplify.** Translate the virtual instructions into an IR and run optimization passes — constant folding, dead-code elimination, peephole — to collapse the VM's verbosity back toward the original logic. This is where **VTIL**-based tooling (and, for VMProtect x64, NoVmp) shines: it lifts to an optimizable IR and simplifies, turning thousands of virtual ops into a handful of real ones. Triton and miasm support the same lift-and-simplify approach when no ready tool fits the target VM.
Static vs Dynamic
Handlers can be studied statically, but a **dynamic execution trace** — capturing the sequence of handlers actually run for a given input — is often the faster route into a specific virtualized function: it tells you which handlers matter and in what order, so you devirtualize the path that runs rather than the whole VM. Combine them: trace to find the relevant handlers, symbolic-execute them to get semantics, lift the traced bytecode.
Expectations
- **No universal button.** VMProtect and Themida differ, versions differ, and
custom VMs share nothing. Off-the-shelf devirtualizers target specific protector versions and break on others; treat them as accelerators for the pipeline, not replacements for it.
- **The core is recoverable even when the whole is not.** You rarely need to
devirtualize an entire binary — you need the one function with the algorithm. Scope to it.
- **Nested and mutating VMs exist.** Some protectors virtualize inside a virtual
machine, or mutate handlers per build. Recover one layer at a time.
Rationalizations to Reject
- **"A tool devirtualized it, so I'm done."** Automated devirtualizers match
specific protector versions and silently produce partial or wrong output on others. Validate the recovered logic against the binary's observed behaviour.
- **"I have to devirtualize the whole binary."** You need the target function.
Trace to it and lift only what runs; whole-binary devirtualization is usually wasted effort.
- **"The handlers are too big to read."** A handler is one micro-op with a lot
of obfuscation around it. Symbolic-execute it for the semantics instead of reading the noise.
- **"It's still packed, I'll devirtualize first."** Unpack first
(`unpacking-protected-binaries`); devirtualization operates on the revealed code, and anti-debug/anti-dump defenses will fight you until the outer layer is off.
- **"The virtual instruction stream is the answer."** The raw bytecode is not
readable logic — you must lift and *simplify* it. The optimization passes are what turn recovered opcodes
Read more
name: devirtualizing-vm-protected-code description: Recover the original logic from code protected by a virtualization obfuscator — VMProtect, Themida/WinLicense, Code Virtualizer, or a custom opcode VM — by locating the VM dispatcher, reverse-engineering the handlers into semantics, extracting the virtual bytecode, and lifting it to a simplified IR with Triton, miasm, or VTIL-based tools. Use when a function became a giant fetch-decode-dispatch loop, when analysis shows a handler table instead of normal code, or after unpacking reveals a virtualized core. verified: 2026-08-07
Devirtualizing VM-Protected Code
Virtualization obfuscation replaces native instructions with bytecode for a custom virtual machine embedded in the binary, then runs that bytecode through an interpreter. The original logic is not gone — it is expressed in an instruction set you have to recover first. Devirtualization is a fixed pipeline: find the VM, understand its handlers, extract the bytecode, and lift it back to something readable. The obfuscator changes every build, so the pipeline, not any one tool, is the durable skill.
When to Use
- A function turned into a large `fetch-decode-dispatch` loop with a handler
table instead of ordinary control flow
- Binaries protected by VMProtect, Themida/WinLicense, Oreans Code Virtualizer,
or a bespoke opcode VM
- Recovering the algorithm inside a virtualized function (a licence check, a
crypto routine, anti-cheat logic)
- After unpacking, when the real code is virtualized rather than merely packed
When NOT to Use
- **Unpacking, dumping, and fixing imports** of a packed/protected binary — that
is `unpacking-protected-binaries`, and it comes *first*: unpack the outer protection, then devirtualize the virtualized core it reveals.
- **Ordinary (non-virtualized) obfuscation** — junk code, opaque predicates,
string encryption — is normal work for `analyzing-binaries`.
- **Virtualized/obfuscated JavaScript** — `reversing-obfuscated-javascript`.
- **Exploiting a bug** in the recovered logic — `exploiting-memory-corruption`.
The Pipeline
**1. Locate the VM.** Find the transition from native to virtual: the `vm_enter` stub that saves native context and sets up the virtual machine, the dispatcher loop that fetches the next virtual opcode and jumps through a handler table, and the `vm_exit` that restores native context. The dispatcher is the anchor for everything else.
**2. Recover the VM architecture.** Identify the **virtual context** — the structure holding the VM's registers and virtual instruction pointer — and how the dispatcher decodes an opcode into a handler index. Note the VM's shape: stack-based vs register-based, opcode encoding, and any key/rolling obfuscation on the bytecode pointer.
**3. Understand the handlers.** Each handler implements one virtual instruction — a micro-operation like add, load, store, xor, push, or a native call. Analyze handlers individually; **symbolic execution of a single handler** (Triton, miasm) yields its semantics far faster than reading it by hand, because a handler is small and side-effect-focused even when the surrounding VM is huge. Build a table mapping opcode → semantics.
**4. Extract the bytecode.** With the handlers understood, read the virtual instruction stream the dispatcher walks — the actual program, in the VM's instruction set.
**5. Lift and simplify.** Translate the virtual instructions into an IR and run optimization passes — constant folding, dead-code elimination, peephole — to collapse the VM's verbosity back toward the original logic. This is where **VTIL**-based tooling (and, for VMProtect x64, NoVmp) shines: it lifts to an optimizable IR and simplifies, turning thousands of virtual ops into a handful of real ones. Triton and miasm support the same lift-and-simplify approach when no ready tool fits the target VM.
Static vs Dynamic
Handlers can be studied statically, but a **dynamic execution trace** — capturing the sequence of handlers actually run for a given input — is often the faster route into a specific virtualized function: it tells you which handlers matter and in what order, so you devirtualize the path that runs rather than the whole VM. Combine them: trace to find the relevant handlers, symbolic-execute them to get semantics, lift the traced bytecode.
Expectations
- **No universal button.** VMProtect and Themida differ, versions differ, and
custom VMs share nothing. Off-the-shelf devirtualizers target specific protector versions and break on others; treat them as accelerators for the pipeline, not replacements for it.
- **The core is recoverable even when the whole is not.** You rarely need to
devirtualize an entire binary — you need the one function with the algorithm. Scope to it.
- **Nested and mutating VMs exist.** Some protectors virtualize inside a virtual
machine, or mutate handlers per build. Recover one layer at a time.
Rationalizations to Reject
- **"A tool devirtualized it, so I'm done."** Automated devirtualizers match
specific protector versions and silently produce partial or wrong output on others. Validate the recovered logic against the binary's observed behaviour.
- **"I have to devirtualize the whole binary."** You need the target function.
Trace to it and lift only what runs; whole-binary devirtualization is usually wasted effort.
- **"The handlers are too big to read."** A handler is one micro-op with a lot
of obfuscation around it. Symbolic-execute it for the semantics instead of reading the noise.
- **"It's still packed, I'll devirtualize first."** Unpack first
(`unpacking-protected-binaries`); devirtualization operates on the revealed code, and anti-debug/anti-dump defenses will fight you until the outer layer is off.
- **"The virtual instruction stream is the answer."** The raw bytecode is not
readable logic — you must lift and *simplify* it. The optimization passes are what turn recovered opcodes
**Security skills for Claude Code that encode the judgment professionals bring, not another wrapper around a scanner.** Offense, defense, and the reverse-engineering and code-audit core both sides share. Every skill is fact-checked against primary sources.
Other skills on secskills.
More skills from other plugins.
api-security
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
abusing-dpapi-for-cred…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
clean-user-facing-text
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…
Questions about devirtualizing-vm-protected-code.
- Which coding agents can use devirtualizing-vm-protected-code?
- devirtualizing-vm-protected-code installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

