vm-and-bytecode-reverse
Custom VM and bytecode reverse engineering playbook. Use when CTF challenges or protected software implement custom virtual machines with proprietary bytecode, dispatcher loops, or maze-style challenges.
Security Assessment
About vm-and-bytecode-reverse
A reverse-engineering playbook for custom virtual machines and bytecode interpreters, aimed at CTF challenges and protected software that implement proprietary bytecode, dispatcher loops, or maze-style puzzles. It focuses on recognizing the fetch-decode-execute pattern that base models often miss, so that VM bytecode is analyzed as its own instruction set rather than as native code.
Identification comes first: a table maps binary patterns to VM types. A while-loop switch over bytecode indicates a switch-based dispatcher, an indirect jump through a table indicates a table-based dispatcher, nested if-else chains indicate an if-chain dispatcher, dominant push/pop indicates a stack-based VM, register-array operations indicate a register-based VM, and a 2D grid with directional input indicates a maze challenge. The analysis methodology then walks through finding the dispatcher, mapping each opcode to an operation (value, type, operand count, operand type, and side effects), extracting the bytecode program from the binary, writing a custom disassembler in Python, and analyzing the disassembled program to trace input to comparison logic (often XOR or ADD transforms checked against constants).
Reference material covers common VM designs: stack-based VMs with opcodes like PUSH, POP, ADD, XOR, CMP, and JMP; register-based VMs with encoded operands; and Brainfuck-like esoteric VMs, plus maze challenges where the grid is extracted from a data section and solved with BFS or DFS. Related routing points to deobfuscation for commercial protectors such as VMProtect and Themida, symbolic execution with angr for VM-based challenges, and anti-debugging when the VM includes anti-debug checks. Use it whenever a target's real logic runs inside a bespoke interpreter and must be reconstructed to recover a key or pass a check.
FAQ
What is this skill for?
Reverse engineering custom virtual machines and bytecode interpreters found in CTF challenges and protected software, including dispatcher loops and maze-style challenges.
How do I identify what kind of VM I am facing?
A pattern table maps clues to VM types: switch-over-bytecode loops, table-based indirect jumps, if-else chains, stack push/pop dominance, register-array operations, or a 2D grid with directional input for maze challenges.
What is the recommended analysis process?
Find the dispatcher, map each opcode to an operation and its operands, extract the bytecode from the binary, write a custom disassembler (a Python template is provided), then analyze the disassembly to trace input to the success/failure check.
Does it cover maze challenges?
Yes. It shows how to extract the grid from a data section and solve it with BFS or DFS, using coordinates and a win condition.
What related skills does it reference?
Deobfuscation for commercial protectors like VMProtect and Themida, symbolic-execution-tools (angr) for VM-based challenges, and anti-debugging techniques when the VM includes anti-debug checks.
Install vm-and-bytecode-reverse
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
yaklang/hack-skills