CVE-2021-21277
JSON

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 packageVersionsReported by
peerigon angular-expressions< 1.1.2, before 1.1.2CVE List, NVD
angular-expressions (npm)before 1.1.2GitHub Advisory Database

All scores

GitHub_M8.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD6.5medium CVSS:2.0AV: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:

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".&#xa0;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.&#xa0;La seguridad del paquete podría omitirse usando una carga útil más compleja, utilizando una técnica ".constructor.constructor".&#xa0;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).&#xa0;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.&#xa0;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

Sources

SourceRecordLicence
CVE ListCVE-2021-21277 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-j6px-jwvv-vpwq changed 2026-09-10CC-BY-4.0
NVDCVE-2021-21277 changed 2026-06-17Public domain