CVE-2020-5219: Angular expressions Remote Code Execution Vulnerability
HIGHCVE-2020-5219 is a HIGH (CVSS 8.7) remote code execution vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Angular expressions libraries in the npm ecosystem. The issue involves remote code execution in angular expressions. Remediation is available by upgrading affected packages to version 1.0.1.
CVE-2020-5219 at a Glance
Security Impact
CVSS: 8.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2020-5219
To remediate this vulnerability, upgrade all affected Angular expressions dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install angular-expressions@1.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls angular-expressions
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-5219, inspect your project dependencies using npm:
npm ls angular-expressions
Analyze the terminal output to locate any version of Angular expressions in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.1), your application is affected.
Note: The npm ls angular-expressions command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Angular expressions, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-5219 Affected Angular expressions Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
angular-expressions
|
npm |
< 1.0.1
|
1.0.1
|
References
Frequently Asked Questions
What is CVE-2020-5219?
Which Angular expressions versions are affected?
What version fixes CVE-2020-5219?
Is angular-expressions affected?
What is the CVSS score of CVE-2020-5219?
What CWE is associated with CVE-2020-5219?
How can I check npm dependencies for CVE-2020-5219?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hxhm-96pp-2m43",
"modified" : "2021-01-08T20:33:38Z",
"published" : "2020-01-24T15:27:25Z",
"aliases" : [ "CVE-2020-5219" ],
"summary" : "Remote Code Execution in Angular Expressions",
"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\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.0.1 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "angular-expressions"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/peerigon/angular-expressions/security/advisories/GHSA-hxhm-96pp-2m43"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5219"
}, {
"type" : "WEB",
"url" : "https://github.com/peerigon/angular-expressions/commit/061addfb9a9e932a970e5fcb913d020038e65667"
}, {
"type" : "WEB",
"url" : "http://blog.angularjs.org/2016/09/angular-16-expression-sandbox-removal.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-01-24T15:27:04Z",
"nvd_published_at" : null
}
}