Documentation

VM Bytecode Protection

Reference guides for release workflows, command-line usage, cross-file protections, and the desktop app.

Inside the Docs

Practical guides for real release work.

How-to guides Start with release sequencing and command-line usage, then move into feature-specific references.
Advanced protection Browse cross-file controls like Replace Globals and Protect Members when a build spans multiple scripts.

VM Bytecode Protection

  • UseVMProtection
  • Basic, Corporate or Enterprise

VM bytecode protection compiles selected functions to a per-build virtual-machine instruction set and ships a small JS interpreter to execute them at runtime. This is a different protection class from the static transforms in Maximum mode (encrypted constants, flat control flow, polymorphic decoder) — the virtualizer's output has no source-level structure left to recover, only opcodes that an attacker would have to reimplement the VM to follow.

Why this matters in 2026: hybrid LLM + compiler-IR deobfuscators (see Google's CASCADE paper) can now identify and invert most static-transform prelude functions — the string-array decoder, the control-flow dispatcher — without per-build hand-rolled rules. Per-build polymorphism still raises the per-build cost, but no longer holds the line against a CASCADE-class attacker. VM bytecode does, because the protection isn't a transformation of static data: it's a custom-instruction-set execution. The IR pass that inverts a decoder doesn't know how to invert an opcode dispatch. Read the threat-model write-up ›

Security reviewer? Start with the VM Protection Proof Pack for sample input, protected-output shape, compatibility limits, performance guidance, and release-report evidence.

What it changes

Functions you mark with an @virtualize comment are removed from the output as readable JavaScript. They are replaced with bytecode and a small VM interpreter that loads, decodes, and dispatches those opcodes when the function is called. From the calling site, the function still has the same name and signature; from a static-analysis standpoint, the body is gone.

Functions you do not mark are processed normally by the rest of the Maximum-mode pipeline. You should not virtualize hot paths — see the When to use it guidance below.

API usage

Set the option on the obfuscation request:

{
  "Items": [{ "FileName": "app.js", "FileCode": "..." }],
  "EncryptStrings": true,
  "FlatTransform": true,
  "UseVMProtection": true
}

Mark functions to virtualize with an @virtualize comment on the line above the function declaration:

// @virtualize
function checksum(text) {
    let hash = 0;
    for (let i = 0; i < text.length; i++) {
        hash = (hash * 31 + text.charCodeAt(i)) | 0;
    }
    return hash;
}
console.log(checksum("abc")); // 96354

Functions without the marker are not virtualized.

Marker format. Use // @virtualize, /* @virtualize */, or /** @virtualize */ immediately before a supported function declaration. The pipeline normalizes block and JSDoc markers to the same internal line marker before the VM sidecar runs. If the service reports that no function was virtualized, confirm the marker is directly above a supported synchronous function declaration.

Multi-file projects collapse to a single bundled output. When UseVMProtection=true is honored on the request, the response's Items array contains one file regardless of how many were submitted. The customer's input files are concatenated, the marked functions are virtualized, the VM interpreter is inlined at the top, and the resulting single .js file is returned. If you rely on per-file output (separate scripts per HTML page, route-specific bundles, etc.), keep UseVMProtection=false for those builds — or virtualize only the build that contains the security-critical functions, and ship the rest of your bundles through standard Maximum mode.

When to use it

  • License validation, key derivation, anti-tamper checks — cold paths where the algorithm is the asset. The slowdown is irrelevant because they run rarely.
  • Watermarking and fingerprinting routines — logic an attacker would otherwise lift wholesale.
  • Small functions in the security perimeter — the VM cost is per-instruction; a 50-instruction function adds microseconds, not milliseconds.

When not to use it

  • Rendering loops, animation tick handlers, hot network parsers — VM execution is meaningfully slower than native; a virtualized 60-fps game loop will not stay at 60 fps.
  • Functions called from requestAnimationFrame or tight setTimeout loops — same reason.
  • async / await functions — async functions are skipped with an engine warning rather than virtualized.

Per-build polymorphism

Every build regenerates the VM. The same source compiled twice produces two structurally different bundles — different bytecode bytes, different dispatcher shape, different identifier names. A deobfuscator that solves one build's structure does not get the next for free. This matches the per-build polymorphism principle the rest of Maximum mode already uses.

Honest limits

  • VM protection raises the static reverse-engineering bar substantially. It does not stop runtime observation: a determined attacker can attach a debugger, log every dispatcher invocation, and reconstruct the bytecode-to-source mapping. Pair with anti-debug + runtime monitoring for that threat.
  • VM-aware deobfuscators exist for some commercial obfuscators. Per-build polymorphism is the defense; but assume the technique is not a one-way function.
  • Multi-file projects with UseVMProtection=true return a single bundled .js file in the response (see the API-usage section above). Build-time decision; if you rely on per-file output, keep UseVMProtection=false for those builds.
  • The compiler accepts up to 1 MiB of metadata and 256 MiB of bundled output. A run is limited to at most 300 seconds. If a job exceeds a limit, the request returns an error and no output.

JavaScript feature support

The table lists supported constructs and restrictions. Unsupported marked functions produce a warning. If no function can be virtualized, the VM request returns an error and no output.

Category Virtualized Skipped → standard Maximum mode
Variables let, const, var (with hoisting) Closures — variables captured from an enclosing scope (a virtualized function may use only its own parameters, locals, and globalThis globals)
Operators All arithmetic, bitwise, comparison and logical operators, including ==/!= and >>>; typeof, delete, in, instanceof, void —
Control flow if/else, C-style for, for...of, for...in, while, do...while, switch, break/continue (including labeled), try/catch/finally, throw —
Functions Arrow functions, default parameters, rest parameters async/await, generator functions (function*), the this and super keywords
Calls & objects new, method calls, optional chaining (?.), spread in calls and array/object literals Spread into a new expression; getters/setters in object literals
Data & access Template literals, regular-expression literals, destructuring (parameters, declarations, assignments, for...of, catch), array/object literals, member access / assignment / update (obj.x++) Tagged template literals (tag`...`); meta-properties (new.target, import.meta)

Very large functions also fall back: more than ~256 locals, or array/object literals with more than 65,535 elements. If a function you want to protect uses something in the right-hand column, virtualize the enclosing function instead, or leave that function to standard Maximum mode.

Performance

VM execution is meaningfully slower than native JavaScript. The exact factor depends on the function: tight inner loops with cheap per-instruction work pay the most; functions dominated by string operations or method calls amortize the dispatcher cost over more native work and pay much less.

Measure per-call cost on your own functions and target devices. Infrequent license-validation or integrity checks are better candidates than hot loops, but neither a universal microsecond cost nor an invisible performance impact is guaranteed. Benchmark startup, repeated calls and bundle size before enabling VM in production.

Bundle-size impact includes the shared VM dispatcher and each virtualized function's bytecode payload. Measure the resulting bundle: the relative increase depends on the function and original bundle size.

Tier availability

Plan eligibility: Basic and above include VM beta. When the staged rollout gate is enabled, plan eligibility alone does not enroll the account. Basic, Corporate and Enterprise account owners can activate VM Protection from their dashboard. Select Enable VM and check for VM Protection — active before submitting a paid VM job.

Successful paid VM jobs count toward the existing monthly plan allowance by original input bytes. To try VM without a paid account, select the VM trial on the online tool.

This is Richscripts' own VM trial for JavaScript Obfuscator, separate from obfuscator.io and its plans. The trial allowance is 25,000,000 input bytes over its lifetime, with a 4,000,000-byte per-file ceiling, a minimum charge of 100,000 bytes per job, and one job at a time. The online tool may apply an additional sample-size limit. A visitor cookie and hashed network identifier enforce the allowance; see Privacy. Paid jobs use your protection-plan allowance.

Confirming that a build used VM

Dashboard activation enables account access. Each API job still needs UseVMProtection=true and a supported function marked with // @virtualize. Retain the report with --report build.report.json.

Confirm VMProtectionApplied=true and a positive VMProtectionVirtualizedCount, then review VMProtectionWarnings for individually skipped functions. A public function name may stay unchanged so callers keep working; its implementation can still run through bytecode. Its return value and console output should remain the same.

If an older report omits these fields, that absence alone does not prove that virtualization failed. Rerun the same input and settings to obtain fresh evidence. A skipped function remains under regular obfuscation when other marked functions can be virtualized; a VM job with no virtualized functions is rejected.

Choosing this vs alternatives

Three honest cases where another product is the right choice instead of (or alongside) UseVMProtection:

  • You need managed runtime threat operations. JSO can route runtime telemetry to your monitoring tools and can store first-triage incidents in the hosted dashboard beta. If active attackers are part of your threat model and you want a fully managed security operations console, alert-routing UI, and response workflow, pair Maximum mode with a runtime monitoring platform (Jscrambler, Verimatrix, Digital.ai). Their VM and your VM are not mutually exclusive — you can ship both.
  • Your protected asset belongs in a broader app-shielding program. If you ship DRM keys for premium video, novel cryptographic constants, anti-cheat heuristics, mobile/native binaries, or assets that require managed RASP operations, evaluate enterprise app-shielding vendors such as Verimatrix or Digital.ai. JSO is focused on browser JavaScript protection, release workflow, and customer-owned monitoring.
  • You only need free-tier obfuscation. The open-source javascript-obfuscator npm package and standard playground cover name mangling, control-flow flattening, and string array encoding for free. Obfuscator.io Pro adds VM quotas, but if you do not need account workflow, desktop batches, release reports, or JSO support, the simpler path may be the right baseline.

For the buyer-axis comparison (real opcode interpreter vs CFG flattening, per-build polymorphism, async support, pricing transparency), see VM Protection Across Vendors on the comparison page, the VM proof pack, and the named-vendor breakdown on the blog.

Mark functions with @virtualize, set UseVMProtection=true on a Basic, Corporate or Enterprise tier request, and the response Items will contain a single bundled .js with the virtualized functions in place. Questions: [email protected].

Frequently asked questions

What does bytecode virtualization actually change?

The marked function stops existing as JavaScript. It is compiled to a custom bytecode executed by an interpreter shipped alongside it, so a reader sees a dispatcher and a data blob rather than logic they can follow. That raises the static reverse-engineering bar substantially, which is a different claim from making the logic unrecoverable.

What are the honest limits of VM protection?

It does not stop runtime observation. Someone can attach a debugger, log every dispatcher invocation and reconstruct the mapping between bytecode and behaviour, which is why it should be paired with anti-debug and runtime monitoring where that threat matters. VM-aware deobfuscators also exist for some commercial obfuscators, so the technique should not be treated as a one-way function. Per-build polymorphism is the defence that keeps that work from being reusable across releases.

Which JavaScript features can be virtualized?

Most everyday function bodies compile, including all the arithmetic, bitwise, comparison and logical operators, the full range of control flow, try and catch, arrow functions, default and rest parameters. The notable exclusions are closures, since a virtualized function may use only its own parameters, locals and globalThis globals, along with async and await, generator functions, and the this and super keywords. Unsupported marked functions produce a warning. If no function can be virtualized, the VM request returns an error and no output.

Which functions are good candidates?

Small, self-contained, and valuable. Licence validation, key derivation, anti-tamper checks and watermarking are the canonical fits, and they rarely need any of the excluded constructs. Apply it narrowly: interpreted bytecode is slow relative to native JavaScript, which makes it right for a decision that runs occasionally and wrong for anything on a render path or in a hot loop.

What happens if a VM build exceeds the service limits?

The compiler accepts up to 1 MiB of metadata and 256 MiB of bundled output. A run is limited to at most 300 seconds. If a job exceeds a limit, the request returns an error and no output.

Does enabling VM protection change my output file layout?

Yes, for multi-file projects, and it is a build-time decision worth knowing in advance. A multi-file project built with VM protection enabled returns a single bundled JavaScript file rather than per-file output. If your deployment depends on per-file artifacts, keep VM protection off for those builds and apply it to the specific bundle where it earns its cost.

Try this in the online obfuscator

Paste your own code and see this option applied, or compare plans for larger projects and the desktop app.

Try It Free See Pricing