CVE-2024-21541: Dom iterator Dom-iterator Code Execution Vulnerability Vulnerability
MODERATECVE-2024-21541 is a MODERATE (CVSS 7.3) dom-iterator code execution vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Dom iterator libraries in the npm ecosystem. The issue involves dom-iterator code execution vulnerability. Remediation is available by upgrading affected packages to version 1.0.1.
CVE-2024-21541 at a Glance
Security Impact
CVSS: 7.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2024-21541
To remediate this vulnerability, upgrade all affected Dom iterator 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 dom-iterator@1.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls dom-iterator
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-21541, inspect your project dependencies using npm:
npm ls dom-iterator
Analyze the terminal output to locate any version of Dom iterator 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 dom-iterator 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 Dom iterator, 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-21541 Affected Dom iterator Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dom-iterator
|
npm |
< 1.0.1
|
1.0.1
|
References
Frequently Asked Questions
What is CVE-2024-21541?
Which Dom iterator versions are affected?
What version fixes CVE-2024-21541?
Is dom-iterator affected?
What is the CVSS score of CVE-2024-21541?
What CWE is associated with CVE-2024-21541?
How can I check npm dependencies for CVE-2024-21541?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jrvm-mcxc-mf6m",
"modified" : "2025-01-14T21:18:03Z",
"published" : "2024-11-13T06:30:29Z",
"aliases" : [ "CVE-2024-21541" ],
"summary" : "dom-iterator code execution vulnerability",
"details" : "Versions of the package dom-iterator before 1.0.1 are vulnerable to Arbitrary Code Execution due to use of the Function constructor without complete input sanitization. Function generates a new function body and thus care must be given to ensure that the inputs to Function are not attacker-controlled. The risks involved are similar to that of allowing attacker-controlled input to reach eval.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "dom-iterator"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.0.0"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21541"
}, {
"type" : "WEB",
"url" : "https://github.com/matthewmueller/dom-iterator/commit/9e0e0fad5a251de5b42feb326c4204eb04080805"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/matthewmueller/dom-iterator"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-8383166"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-JS-DOMITERATOR-6157199"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-11-13T18:34:51Z",
"nvd_published_at" : "2024-11-13T05:15:14Z"
}
}