{"id":"GHSA-j6px-jwvv-vpwq","summary":"Angular Expressions - Remote Code Execution","details":"### Impact\n\nThe vulnerability, reported by GoSecure Inc, allows Remote Code Execution, if you call `expressions.compile(userControlledInput)` where `userControlledInput` is text that comes from user input.\n\nThis time, the security of the package could be bypassed by using a more complex payload, using a `.constructor.constructor` technique.\n\n* If running angular-expressions in the browser, an attacker could run any browser script when the application code calls expressions.compile(userControlledInput).\n* If running angular-expressions on the server, an attacker could run any Javascript expression, thus gaining Remote Code Execution.\n\n### Patches\n\nUsers should upgrade to version 1.1.2 of angular-expressions\n\n### Workarounds\n\nA temporary workaround might be either to : \n\n* disable user-controlled input that will be fed into angular-expressions in your application\n\nOR\n\n* allow only following characters in the userControlledInput : \n\n```js\nif (/^[|a-zA-Z.0-9 :\"'+-?]+$/.test(userControlledInput)) {\n      var result = expressions.compile(userControlledInput);\n}\nelse {\n     result = undefined;\n}\n```\n\n### References\n\n[Removal of angular-expression sandbox](http://blog.angularjs.org/2016/09/angular-16-expression-sandbox-removal.html)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [angular-expressions](https://github.com/peerigon/angular-expressions/issues)\n* [Email us](mailto:contact@javascript-ninja.fr)\n\n### Credits \n\nThe issue was reported by Maxime Nadeau from GoSecure, Inc.","aliases":["CVE-2021-21277"],"modified":"2026-05-07T05:02:58.882360187Z","published":"2021-02-01T15:01:26Z","database_specific":{"github_reviewed_at":"2021-02-01T15:00:53Z","nvd_published_at":"2021-02-01T15:15:00Z","cwe_ids":["CWE-74","CWE-94"],"severity":"HIGH","github_reviewed":true},"references":[{"type":"WEB","url":"https://github.com/peerigon/angular-expressions/security/advisories/GHSA-j6px-jwvv-vpwq"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21277"},{"type":"WEB","url":"https://github.com/peerigon/angular-expressions/commit/07edb62902b1f6127b3dcc013da61c6316dd0bf1"},{"type":"WEB","url":"https://www.npmjs.com/package/angular-expressions"},{"type":"WEB","url":"http://blog.angularjs.org/2016/09/angular-16-expression-sandbox-removal.html"}],"affected":[{"package":{"name":"angular-expressions","ecosystem":"npm","purl":"pkg:npm/angular-expressions"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.1.2"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/02/GHSA-j6px-jwvv-vpwq/GHSA-j6px-jwvv-vpwq.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}