Devirtualizing Vm Protected Codeのロゴ

Devirtualizing Vm Protected Code

コミュニティ
trilwu
devirtualizing-vm-protected-code

仮想化難読化ツール(VMProtect、Themida/WinLicense、Code Virtualizer、カスタムopcode VM)で保護されたコードから、元のロジックを復元します。VMディスパッチャーを特定し、ハンドラーをリバースエンジニアリングして意味を解明し、仮想バイトコードを抽出し、Triton、miasm、VTILベースのツールで簡略化したIRに変換します。関数が巨大なフェッチ・デコード・ディスパッチループになっている場合、解析で通常のコードではなくハンドラーテーブルが見つかった場合、またはアンパック後に仮想化されたコアが明らかになった場合に使用します。

Add to TypingMind

概要

公開者trilwu
リポジトリsecskills
スキル名devirtualizing-vm-protected-code
スター
144
フォーク
15
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    trilwuがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Devirtualizing Vm Protected Code」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/trilwu/secskills/tree/main/secskills-core/skills/devirtualizing-vm-protected-code
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/trilwu/secskills.git /tmp/secskills
mkdir -p .claude/skills
cp -r /tmp/secskills/secskills-core/skills/devirtualizing-vm-protected-code .claude/skills/devirtualizing-vm-protected-code
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDevirtualizing Vm Protected Codeを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にDevirtualizing Vm Protected Codeを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Devirtualizing Vm Protected Codeは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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 back into the algorithm.

References

  • unpacking-protected-binaries — remove packing/anti-debug before devirtualizing
  • analyzing-binaries — general RE of the recovered, devirtualized code
  • reviewing-cryptography — when the virtualized routine is a crypto/licence check
  • exploiting-memory-corruption — exploiting a bug in the recovered logic

よくある質問

AIスキル「Devirtualizing Vm Protected Code」では何ができますか?

仮想化難読化ツール(VMProtect、Themida/WinLicense、Code Virtualizer、カスタムopcode VM)で保護されたコードから、元のロジックを復元します。VMディスパッチャーを特定し、ハンドラーをリバースエンジニアリングして意味を解明し、仮想バイトコードを抽出し、Triton、miasm、VTILベースのツールで簡略化したIRに変換します。関数が巨大なフェッチ・デコード・ディスパッチループになっている場合、解析で通常のコードではなくハンドラーテーブルが見つかった場合、またはアンパック後に仮想化されたコアが明らかになった場合に使用します。

TypingMindでDevirtualizing Vm Protected Codeを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Devirtualizing Vm Protected Codeはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDevirtualizing Vm Protected Codeをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/trilwu/secskills/tree/main/secskills-core/skills/devirtualizing-vm-protected-codeを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Devirtualizing Vm Protected Codeを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Devirtualizing Vm Protected Codeで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDevirtualizing Vm Protected Codeを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Devirtualizing Vm Protected Code」は無料ですか?

はい。trilwuがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇