Security Digest · Vulnerability record

CVE-2026-57138: npm PraisonAI codeMode sandbox escape via Function constructor

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, codeMode in src/praisonai-ts/src/tools/builtins/code-mode.ts executes untrusted JavaScript with new Function() inside with(sandbox) and relies on a small source-code blocklist plus shadowed process and require properties.

CVSS 9.9 Critical EPSS 0.7% · p54

Should you act?

Critical, preconditions apply

Severe if exploited, but exploitation needs conditions that may not apply to you. This signal is computed from CISA KEV, EPSS and CVSS data; it is not an editorial verdict.

  • Not in CISA KEV, but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
  • EPSS 0.7%, percentile 54: FIRST’s model estimates a 0.7% chance of exploitation activity in the next 30 days, higher than 54% of all scored CVEs (moderate). EPSS is a probability, not a verdict.
  • Needs an account (low (any account)). Exposure depends on who can log in.
  • Only applies if your dependency tree includes praisonai (npm) >= 1.4.0, <= 1.7.1, fixed in 1.7.2. Check your lockfile, including transitive dependencies.

What it is

PraisonAI is a multi-agent teams system. From 1.4.0 until 1.7.2, codeMode in src/praisonai-ts/src/tools/builtins/code-mode.ts executes untrusted JavaScript with new Function() inside with(sandbox) and relies on a small source-code blocklist plus shadowed process and require properties. Code can use ({}).constructor.constructor to recover the real Function constructor, obtain process and process.mainModule.require, and reach host filesystem and subprocess APIs despite the advertised sandbox. Attackers who control codeMode input can read secrets, modify files, execute commands, or exhaust the host process. This issue is fixed in version 1.7.2.

From the GitHub advisory

Summary

The published npm package praisonai exports a TypeScript built-in tool named codeMode. The package describes this tool as executing code in a sandboxed environment, marks its capability as sandbox: true, and registers it through the public tools facade.

The implementation does not create an isolation boundary. It applies a small regular-expression blocklist, sets process and require to undefined inside a plain JavaScript object, and then executes attacker-controlled code with the host process new Function constructor:

Because this runs in the host V8 context, code inside codeMode can use the JavaScript prototype chain to recover the real Function constructor:

From a normal CommonJS application script, the recovered process object exposes process.mainModule.require. That bypasses the explicit require('fs') and require('childprocess') controls and allows host filesystem access and subprocess execution from code that was supposed to be sandboxed.

Weakness type: CWE-184, CWE-693.

Product: praisonai (npm) · Assigned by: GitHub_M · Published: 2026-09-15

Affected and fixed versions

EcosystemPackageVulnerableFirst fixed
npmpraisonai>= 1.4.0, <= 1.7.11.7.2
VendorProductAffected versions (per CVE record)
MervinPraisonPraisonAI>= 1.4.0, < 1.7.2

Severity scores

Scored byCVSSScoreVector
GitHub_M3.19.9 CriticalCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
GitHub3.19.9 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
  • Attack vector: network (remotely reachable)
  • Attack complexity: low
  • Privileges required: low (any account)
  • User interaction: none
  • Scope: changed (can affect other components)

CVSS measures how bad a flaw is if exploited, not how likely exploitation is. Read it next to the exploitation data below.

Exploitation and urgency

  • CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
  • CISA SSVC assessment: exploitation poc, automatable no, technical impact total.
  • FIRST EPSS (model of 2026-10-21): 0.73% probability of exploitation activity in the next 30 days; percentile 54.

Timeline

  • — GitHub-reviewed advisory GHSA-vmmj-pfw7-fjwp published (critical)
  • — CVE record published by GitHub_M
  • — CVE record last updated

Sources and references

Original sources first. Version and fix details should always be confirmed against the vendor or project advisory.

Vulnerability records

  1. GitHub Advisory GHSA-vmmj-pfw7-fjwp github.com
  2. CVE.org record CVE-2026-57138 cve.org
  3. NVD entry CVE-2026-57138 nvd.nist.gov

Other references from the CVE record and advisory

  1. github.com github.com
  2. github.com github.com
  3. github.com github.com

Critical npm advisories · Today’s Security Digest