V8 Bytecode Decompiler Link 🎁 🎯
V8 bytecode decompiler is a specialized security and reverse-engineering tool designed to convert serialized V8 bytecode (often found in
files) back into high-level, human-readable JavaScript-like code. Check Point Research Key Features and Capabilities Tools like (developed by Check Point Research) or
offer several specific features for analyzing compiled JavaScript: Check Point Research Static Analysis of Serialized Objects : These tools can parse and decompile files (V8’s cached_data
format) without needing to execute the potentially malicious code. High-Level Representation : Instead of just disassembling to raw opcodes (like LdaConstant
), they generate a "pseudo-JavaScript" that mimics the original logic, including control flows and function structures. Metadata Recovery
: Depending on the V8 version and compilation flags, these tools can sometimes recover variable and parameter names, which are often stored in the serialized data. V8 Version Compatibility
: Modern decompilers often use a patched, compiled V8 binary to ensure they correctly interpret the opcodes for specific versions (e.g., the version used to compile the file). Malware Analysis Support
: They are primarily used by security researchers to analyze campaigns like
, which use V8 bytecode to hide malicious intent from traditional scanners. Check Point Research Popular Tools
: An open-source Python-based tool that provides a readable textual output from V8 objects. v8 bytecode decompiler
: A more recent project that integrates and modifies View8 for better reverse engineering of JSC bytecode. Ghidra NodeJS Plugin : A plugin for the
framework that adds support for disassembling and decompiling Bytenode binaries. Check Point Research Are you looking to reverse engineer a specific file or learn more about V8's internal opcodes
xqy2006/jsc2js: Reverse V8‑generated JSC bytecode ... - GitHub
参考与致谢. View8:. suleram/View8 (已在本仓库中集成修改). 博客与资料参考:. https://guage.cool/wiz-license.html · https://rce.moe/2025/01/07/v8-bytecode- Exploring Compiled V8 JavaScript Usage in Malware
protected files or Electron applications that hide source code in cachedData Core Challenges in V8 Decompilation Unlike Java bytecode, V8 bytecode is highly unstable and tied to specific engine versions. Version Sensitivity
: Every minor V8 version can change opcode values, register layouts, and parameter semantics. Context Loss
: V8 bytecode is a serialized internal state. Without the original source's "magic numbers," hashes, and specific flags, the engine will reject the bytecode.
: Many public tools often crash or only export a few functions when faced with complex obfuscation or mismatched versions. 看雪安全社区 Available Tools & Approaches
There is no single "magic" tool, but developers typically use these projects: V8 bytecode decompiler is a specialized security and
: A specialized tool for reversing V8-generated JSC bytecode into approximate JavaScript. : A decompiler often paired with specific
binaries (e.g., version 9.4.146.24) to extract function structures. Ghidra / Static Analysis : In cases where bytecode is embedded in files, researchers use Ghidra to map ByteCodeInfo structures and identify filename/function mappings. Typical Workflow for Reversing Bytenode Identify the Version
: Check the application's Electron or Node.js version to match the correct V8 engine version. Patch the Engine : Modify V8 source code (usually ) to bypass sanity checks like SanityCheckWithoutSource kMagicNumber mismatches. Execute & Dump
: Run the bytecode through the patched engine to trigger the serialization/deserialization logic, capturing the human-readable output. 看雪安全社区 Are you looking to decompile a specific file or a Bytenode-protected Electron app?
V8 字节码反编译还原bytenode保护的js代码 - 白帽酱の博客
This report examines the landscape of V8 bytecode decompilers, tools designed to reverse-engineer the intermediate representation (bytecode) used by Google’s V8 JavaScript engine back into high-level, human-readable code. Overview of V8 Bytecode V8 utilizes an interpreter called
to convert an Abstract Syntax Tree (AST) into bytecode. This bytecode is a low-level, machine-agnostic representation that allows for fast startup times before the
optimizing compiler converts "hot" functions into machine code. V8 JavaScript engine Key V8 Bytecode Decompiler Tools
While V8 provides a built-in disassembler (accessible via the --print-bytecode then later a string)
flag), true decompilers that reconstruct JavaScript-like source code are primarily community-driven projects. Exploring Compiled V8 JavaScript Usage in Malware
Reviewing "V8 bytecode decompilers" requires a nuanced approach because, unlike languages like Java or .NET where bytecode decompilation is a mature, standard practice, V8 bytecode decompilation is an adversarial, moving target.
There isn't one single "V8 Decompiler" tool that works universally. Instead, there is a ecosystem of tools built around specific V8 versions.
Here is a detailed review of the state of V8 bytecode decompilation, covering the tools, the process, and the significant challenges involved.
2.1 Disassembly
First, raw bytecode (%00 %23 %A1 ...) is mapped back to mnemonics. V8 provides the --print-bytecode flag for this (in d8 or Node.js with --print-bytecode). Example output:
[generated bytecode for function: add (0x2a0a2815f39 <SharedFunctionInfo add>)]
Parameter count 3
Register count 2
0x2a0a2815f7e @ 0 : 0c 02 Ldar a1
0x2a0a2815f80 @ 2 : 2a 02 00 Add a2, [0]
0x2a0a2815f83 @ 5 : 11 00 Return
3.3 Deoptimization
- Implement deoptimization techniques to recover high-level constructs from the bytecode. This might involve:
- Control Flow Reconstruction: Reconstructing loops, conditionals, and functions.
- Expression Reconstruction: Figuring out expressions and variable assignments.
Implementation notes & techniques
- Target a specific V8 release (or maintain per-version opcode metadata). Use V8 source (bytecode definitions) as canonical reference.
- Parse bytecode array format from heap/serialized snapshot or by attaching to a running process (inspector/protocol) to fetch function BytecodeArray.
- Construct CFG by scanning for branch/jump opcodes and exception handler tables.
- Use abstract interpretation / symbolic stack simulation to infer value shapes and types.
- SSA or temporary-register conversion: convert stack operations into SSA or virtual registers to simplify dataflow analysis.
- Peephole & pattern recognition: detect common idioms (property access, method call, for-loops) and replace sequences with higher-level constructs.
- Heuristics for variable names:
- Prefer names from debug/source position mapping.
- Fall back to canonical names (arg0, tmp1) or infer from property keys and constant strings.
- Preserve semantics: emit code that mirrors evaluation order, side-effects, exception behavior, and lexically scoped bindings.
- Add annotations: include bytecode comments, offsets, and feedback hints to aid analyst understanding.
Part 6: Ethical and Legal Considerations
Using a V8 bytecode decompiler exists in a gray area:
- Proprietary Software: Decompiling for interoperability might be allowed under fair use (e.g., DMCA exemptions), but circumvent license checks is illegal.
- Node.js Applications: Many commercial apps are "compiled" to bytecode via
bytenodeornexe. Decompiling them violates most EULAs. - Malware Analysis: Reverse engineering malware is generally protected as security research.
Golden rule: A decompiler is a tool, not a weapon. Use it on code you own, code you have permission to audit, or malware—not to steal trade secrets.
5. Implementation
- Language: Python + custom V8 bytecode parser (or Rust for performance).
- Modules:
v8_bytecode_parser.py: Reads raw bytecode from dump.cfg_builder.py: Basic block discovery.stack_simulator.py: Tracks accumulator & registers.reconstructor.py: Emits JS code.
- Example transformation:
Bytecode:
LdaSmi 10
Star r0
Ldar r0
CallRuntime 0, 1
Decompiled:
let temp = 10;
console.log(temp);
Suggested project structure
- Opcode metadata module (per V8 version)
- Bytecode parser (BytecodeArray → instruction list)
- CFG builder & exception table handler
- Stack simulator / IR builder (stack → virtual registers / SSA)
- Analyzer passes: constant folding, dead code elimination, pattern detection
- Structurer: high-level control flow recovery (loops, conditionals, switches)
- Pretty-printer with annotations and source map support
- Test suite with bytecode generated from known JS inputs across V8 versions
2.4 Type Inference (Partial)
Because V8 bytecode is untyped (a register can hold a number, then later a string), a decompiler may perform limited type propagation to avoid nonsense output like "5" + 3 when the bytecode shows a number addition.