# CVE-2023-26122: safe-eval sandbox bypass via prototype pollution

Source: https://junglewise.ai/threats/cve-2023-26122-safe-eval-sandbox-bypass-via-prototype-pollution  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2023-04-11. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2023-26122 · Severity: low · CVSS 3.1 · Published 2023-04-11

safe-eval is a JavaScript library designed to safely evaluate code expressions in a sandboxed environment. Due to improper input sanitization, attackers can exploit prototype pollution to escape the sandbox and achieve remote code execution on systems using the library, potentially compromising the entire application and underlying infrastructure.

Technologies: [safe-eval (npm)](https://junglewise.ai/threats/technologies/safe-eval). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2023-26122 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2023-26122 being exploited in the wild.

**How severe is CVE-2023-26122?** Low severity, with a CVSS score of 3.1, published 11 April 2023.

**Which products and versions are affected?** safe-eval (npm) SEMVER:introduced=0,last_affected=0.4.2.

**Is there a fix for CVE-2023-26122?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2023-26122 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2023-26122?** Check whether you run safe-eval (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

safe-eval contains a prototype pollution vulnerability resulting from inadequate input validation and sanitization of user-supplied code. The vulnerability can be exploited through functions such as defineGetter, stack(), toLocaleString(), propertyIsEnumerable.call(), and valueOf() to pollute the prototype chain. An attacker can craft a malicious code string (no authentication required; the vulnerable function is typically called with untrusted input) that escapes the sandbox isolation and executes arbitrary system commands via Node.js runtime functionality. The vulnerability affects all versions up to and including 0.4.2, and successful exploitation results in remote code execution with the privileges of the application process.

## Affected products

- safe-eval safe-eval up to and including 0.4.2

## Identifiers

- CVE-2023-26122
- GHSA-79xf-67r4-q2jj

## Timeline

- 2023-04-11: disclosed: Vulnerability published via GitHub Security Advisory
- 2022-12-21: exploited: Proof of concept demonstrated in GitHub issue #27

## References

- [https://github.com/hacksparrow/safe-eval/issues/27](https://github.com/hacksparrow/safe-eval/issues/27)

## Related threats

- [safe-eval prototype pollution in safeEval function](https://junglewise.ai/threats/cve-2023-26121-safe-eval-prototype-pollution-in-safeeval-function)
- [hacksparrow safe-eval Prototype Pollution in safeEval](https://junglewise.ai/threats/cve-2022-25904-hacksparrow-safe-eval-prototype-pollution-in-safeeval)
- [safe-eval sandbox escape and arbitrary code execution](https://junglewise.ai/threats/safe-eval-sandbox-escape-and-arbitrary-code-execution-8c44a96c)
- [safe-eval sandbox escape and arbitrary code execution](https://junglewise.ai/threats/cve-2020-7710-safe-eval-sandbox-escape-and-arbitrary-code-execution)
- [safe-eval sandbox escape via constructor access](https://junglewise.ai/threats/cve-2017-16088-safe-eval-sandbox-escape-via-constructor-access)
