
Educational lab demonstrating JavaScript expression sandbox escape techniques and patch evolution through multiple vulnerable sandbox versions, with payloads and AST analysis.
A minimal experimental environment for demonstrating JavaScript expression sandbox escape and patch evolution.
Through multiple versions of the sandbox, it implements the progression from:
Fully escapable → patching
this→ then patching destructuring
While preserving new bypass methods, helping to understand the real-world cat-and-mouse game between vulnerabilities and patches.
.
├── payload.js # Various attack payloads
├── sandbox_v0.js # Original vulnerable version
├── sandbox_v1.js # Fixes the this chain
├── sandbox_v2.js # Also fixes destructuring
We want to simulate this reality:
An endless loop.
This project is not meant to be a truly secure VM. Instead, it is meant to observe:
How each "seemingly reasonable" patch is broken by the next technique.
npm install vm2 acorn acorn-walk
node sandbox_vX.js
Replace X with 0 / 1 / 2.
payload.js includes four access methods:
| Name | Technique |
|---|---|
| CVE-2025-68613 / this | Obtains process via this |
| CVE-2026-25049 / destructuring | Gets constructor via object destructuring |
| Reflect.get | Uses the Reflect API |
| Dynamic Reflect | Dynamic property access |
Features:
Result: All payloads pass.
Attackers are as happy as can be.
Changes:
"use strict".call(undefined)Therefore:
this === undefined
The attacker nods and keeps going down another path.
New additions:
ObjectPatternconstructorBlacklist-style patching typically has:
✔ Fixes a clear path ✔ Low cost ✔ Easy to deploy
But at the same time:
❌ Limited defense surface ❌ Easily bypassed by other semantically equivalent access methods
This is exactly why sandboxes like vm2 have historically suffered repeated escapes.