CVE-2024-54152: Angular expressions Remote Code Execution Vulnerability
CRITICALCVE-2024-54152 is a CRITICAL remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Angular expressions libraries in the npm ecosystem. The issue involves angular expressions - remote code execution when using locals. Remediation is available by upgrading affected packages to version 1.4.3.
CVE-2024-54152 at a Glance
How to Fix CVE-2024-54152
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.4.3
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-2024-54152, 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.4.3), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. 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-2024-54152 Affected Angular expressions Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
angular-expressions
|
npm |
< 1.4.3
|
1.4.3
|
References
Frequently Asked Questions
What is CVE-2024-54152?
Which Angular expressions versions are affected?
What version fixes CVE-2024-54152?
Is angular-expressions affected?
What CWE is associated with CVE-2024-54152?
How can I check npm dependencies for CVE-2024-54152?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5462-4vcx-jh7j",
"modified" : "2024-12-10T20:59:46Z",
"published" : "2024-12-10T16:54:50Z",
"aliases" : [ "CVE-2024-54152" ],
"summary" : "Angular Expressions - Remote Code Execution when using locals",
"details" : "### Impact\n\nAn attacker can write a malicious expression that escapes the sandbox to execute arbitrary code on the system.\n\nExample of vulnerable code:\n\n```js\nconst expressions = require(\"angular-expressions\");\nconst result = expressions.compile(\"__proto__.constructor\")({}, {});\n// result should be undefined, however for versions <=1.4.2, it returns an object.\n```\n\nWith a more complex (undisclosed) payload, one can get full access to Arbitrary code execution on the system.\n\n### Patches\n\nThe problem has been patched in version 1.4.3 of angular-expressions.\n\n### Workarounds\n\nThere is one workaround if it not possible for you to update : \n\n* Make sure that you use the compiled function with just one argument : ie this is not vulnerable : \n `const result = expressions.compile(\"__proto__.constructor\")({});` : in this case you lose the feature of locals if you need it.\n\n### Credits\n\nCredits go to [JorianWoltjer](https://github.com/JorianWoltjer) who has found the issue and reported it to use. https://jorianwoltjer.com/",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "angular-expressions"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.4.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/peerigon/angular-expressions/security/advisories/GHSA-5462-4vcx-jh7j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-54152"
}, {
"type" : "WEB",
"url" : "https://github.com/peerigon/angular-expressions/commit/97f7ad94006156eeb97fc942332578b6cfbf8eef"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/peerigon/angular-expressions"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-10T16:54:50Z",
"nvd_published_at" : "2024-12-10T16:15:23Z"
}
}