All the vulnerabilities related to the version 0.4.1 of the package
safe-eval vulnerable to Prototype Pollution
All versions of package safe-eval are vulnerable to Prototype Pollution which allows an attacker to add or modify properties of the Object.prototype.Consolidate when using the function safeEval. This is because the function uses vm variable, leading an attacker to modify properties of the Object.prototype.
safe-eval vulnerable to Sandbox Bypass due to improper input sanitization
All versions of the package safe-eval are vulnerable to Sandbox Bypass due to improper input sanitization. The vulnerability is derived from prototype pollution exploitation. Exploiting this vulnerability might result in remote code execution (RCE).
Vulnerable functions:
defineGetter, stack(), toLocaleString(), propertyIsEnumerable.call(), valueOf().
Sandbox Breakout / Arbitrary Code Execution in safe-eval
All versions of safe-eval
are vulnerable to Sandbox Escape leading to Remote Code Execution. A payload chaining a function's callee and caller constructors can escape the sandbox and execute arbitrary code.
For example, the payload
((() => {
const targetKey = Object.keys(this)[0];
Object.defineProperty(this, targetKey, {
get: function() {
return arguments.callee.caller.constructor(
"return global.process.mainModule.require('child_process').execSync('pwd').toString()"
)();
}
});
})();```
may be used to print the `pwd` to the console.
## Recommendation
No fix is currently available. Consider using an alternative package until a fix is made available.
safe-eval vulnerable to Prototype Pollution via the safeEval function
All versions of the package safe-eval are vulnerable to Prototype Pollution via the safeEval function, due to improper sanitization of its parameter content.
Sandbox Breakout / Arbitrary Code Execution in safe-eval
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
.
No fix is currently available. Consider using an alternative package until a fix is made available.