safer-eval is a node JS library that supposedly provides a 'safe' way to 'eval' untrusted javascript.
As the maintainer warns in the README:
Warning: The saferEval function may be harmful - so you are warned!
However, it is still used by various libraries to parse/execute untrusted code in such a way that there is an implied execution sandbox.
The bypass provide here was originally reported to the project vm2 by @XmiliaH in an issue here.
- Remote Code Execution
- Cross Site Scripting
There will be no fix for this vulnerability. Please consider using a different library.
@XmiliaH has provided an even simpler breakout POC here: commenthol/safer-eval#10