# safer-eval sandbox breakout via Object.constructor

Source: https://junglewise.ai/threats/safer-eval-sandbox-breakout-via-object-constructor-d8e87f1c  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2020-08-19. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: info · Published 2020-08-19

safer-eval is a Node.js library that executes arbitrary JavaScript code within a restricted sandbox environment to prevent malicious operations. An attacker can bypass the sandbox restrictions and achieve arbitrary code execution by exploiting the Object.constructor property, potentially allowing them to execute unintended code or access the host system.

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

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Informational severity, published 19 August 2020.

**Which products and versions are affected?** safer-eval (npm) SEMVER:introduced=0,fixed=1.3.2.

**Is there a fix for This vulnerability?** Yes. safer-eval (npm): upgrade to 1.3.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked with local access, in a software library.

**Am I affected?** Check whether you run safer-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.

## How to fix

- safer-eval (npm): upgrade to 1.3.2 or later

  ```sh
  npm install safer-eval@1.3.2
  ```


## Technical details

The vulnerability is a sandbox breakout in safer-eval caused by improper restriction of the Object.constructor property. An attacker can use Object.constructor to escape the sandbox and execute arbitrary code on the host system. The vulnerability affects all versions prior to 1.3.2, where the fix explicitly disallows Object.constructor usage by prepending Object.constructor = function () {}; to the evaluated code. No special authentication or network access is required—exploitation only requires the ability to pass malicious code to the safer-eval library for evaluation.

## Affected products

- commenthol safer-eval before 1.3.2

## Timeline

- 2019-06-05: patched: Fix committed (Object.constructor restriction added)

## References

- [https://github.com/commenthol/safer-eval/commit/1c29f6a6e304fb650c05056e217e457a0d2cc3c5](https://github.com/commenthol/safer-eval/commit/1c29f6a6e304fb650c05056e217e457a0d2cc3c5)
- [https://www.npmjs.com/advisories/787](https://www.npmjs.com/advisories/787)

## Related threats

- [safer-eval sandbox breakout arbitrary code execution](https://junglewise.ai/threats/safer-eval-sandbox-breakout-arbitrary-code-execution-6fed75c1)
- [safer-eval sandbox breakout and arbitrary code execution](https://junglewise.ai/threats/cve-2019-10769-safer-eval-sandbox-breakout-and-arbitrary-code-execution)
- [safer-eval sandbox escape and arbitrary code execution](https://junglewise.ai/threats/cve-2019-10759-safer-eval-sandbox-escape-and-arbitrary-code-execution)
- [safer-eval sandbox escape via constructor property](https://junglewise.ai/threats/cve-2019-10760-safer-eval-sandbox-escape-via-constructor-property)
