VDB
Sign up
CRITICAL9.8

GHSA-hrpq-r399-whgw

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 ```js (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.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/safe-eval
Introduced in: 0

No fixed version published yet for safe-eval (npm). Pin to a known-safe version or switch to an alternative.

References