8.5high
Angular Expressions - Remote Code Execution
- Severity
- 8.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 2.85% (higher than 87% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-j6px-jwvv-vpwq
Description
angular-expressions is "angular's nicest part extracted as a standalone module for the browser and node". In angular-expressions before version 1.1.2 there is a vulnerability which allows Remote Code Execution if you call "expressions.compile(userControlledInput)" where "userControlledInput" is text that comes from user input. The security of the package could be bypassed by using a more complex payload, using a ".constructor.constructor" technique. In terms of impact: If running angular-expressions in the browser, an attacker could run any browser script when the application code calls expressions.compile(userControlledInput). If running angular-expressions on the server, an attacker could run any Javascript expression, thus gaining Remote Code Execution. This is fixed in version 1.1.2 of angular-expressions A temporary workaround might be either to disable user-controlled input that will be fed into angular-expressions in your application or allow only following characters in the userControlledInput.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| peerigon angular-expressions | < 1.1.2, before 1.1.2 | CVE List, NVD |
| angular-expressions (npm) | before 1.1.2 | GitHub Advisory Database |
All scores
| GitHub_M | 8.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 6.5medium CVSS:2.0 | AV:N/AC:L/Au:S/C:P/I:P/A:P |
Classification
What each source says
CVE List
angular-expressions is "angular's nicest part extracted as a standalone module for the browser and node". In angular-expressions before version 1.1.2 there is a vulnerability which allows Remote Code Execution if you call "expressions.compile(userControlledInput)" where "userControlledInput" is text that comes from user input. The security of the package could be bypassed by using a more complex payload, using a ".constructor.constructor" technique. In terms of impact: If running angular-expressions in the browser, an attacker could run any browser script when the application code calls expressions.compile(userControlledInput). If running angular-expressions on the server, an attacker could run any Javascript expression, thus gaining Remote Code Execution. This is fixed in version 1.1.2 of angular-expressions A temporary workaround might be either to disable user-controlled input that will be fed into angular-expressions in your application or allow only following characters in the userControlledInput.
GitHub Advisory Database
Impact
The vulnerability, reported by GoSecure Inc, allows Remote Code Execution, if you call expressions.compile(userControlledInput) where userControlledInput is text that comes from user input.
This time, the security of the package could be bypassed by using a more complex payload, using a .constructor.constructor technique.
- If running angular-expressions in the browser, an attacker could run any browser script when the application code calls expressions.compile(userControlledInput).
- If running angular-expressions on the server, an attacker could run any Javascript expression, thus gaining Remote Code Execution.
Patches
Users should upgrade to version 1.1.2 of angular-expressions
Workarounds
A temporary workaround might be either to :
- disable user-controlled input that will be fed into angular-expressions in your application
OR
- allow only following characters in the userControlledInput :
if (/^[|a-zA-Z.0-9 :"'+-?]+$/.test(userControlledInput)) {
var result = expressions.compile(userControlledInput);
}
else {
result = undefined;
}
References
Removal of angular-expression sandbox
For more information
If you have any questions or comments about this advisory:
- Open an issue in angular-expressions
- Email us
Credits
The issue was reported by Maxime Nadeau from GoSecure, Inc.
NVD (es)
angular-expressions son "angular's nicest part extracted as a standalone module for the browser and node". En angular-expressions anteriores a la versión 1.1.2, existe una vulnerabilidad que permite una Ejecución de Código Remota si llama a "expression.compile(userControlledInput)" donde "userControlledInput" es texto que proviene de la entrada del usuario. La seguridad del paquete podría omitirse usando una carga útil más compleja, utilizando una técnica ".constructor.constructor". En términos de impacto: si ejecuta angular-expressions en el navegador, un atacante podría ejecutar cualquier script del navegador cuando el código de la aplicación llame a expression.compile(userControlledInput). Si ejecuta angular-expressions en el servidor, un atacante podría ejecutar cualquier expresión de Javascript, obteniendo así una ejecución de código remota. Esto se corrigió en la versión 1.1.2 de angular-expressions. Una solución temporal podría ser deshabilitar la entrada controlada por el usuario que se alimentará en angular-expressions en su aplicación o permitir solo seguir caracteres en el userControlledInput
References
| https://github.com/peerigon/angular-expressions/security/advisories/GHSA-j6px-jwvv-vpwq | vendor-advisory, web | |
| https://www.npmjs.com/package/angular-expressions | product, web | |
| http://blog.angularjs.org/2016/09/angular-16-expression-sandbox-removal.html | broken-link, vendor-advisory, web | |
| https://github.com/peerigon/angular-expressions/commit/07edb62902b1f6127b3dcc013da61c6316dd0bf1 | patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-21277 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-21277 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j6px-jwvv-vpwq changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2021-21277 changed 2026-06-17 | Public domain |