Vulnerabilities in pkg:npm/react-dom
PACKAGECVE-2018-6341 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting React dom libraries in the npm ecosystem. The issue involves cross-site scripting in react-dom. Remediation is available by upgrading affected packages to version 16.1.2, 16.0.1, 16.2.1, 16.3.3, 16.4.2.
pkg:npm/react-dom
Vulnerability advisories affecting package pkg:npm/react-dom. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-mvjj-gqq2-p4hw | CVE-2018-6341 | MODERATE | Cross-Site Scripting in react-dom |
CVE-2018-6341 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2018-6341
To remediate this vulnerability, upgrade all affected React dom 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 react-dom@16.1.2
npm install react-dom@16.0.1
npm install react-dom@16.2.1
npm install react-dom@16.3.3
npm install react-dom@16.4.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls react-dom
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2018-6341, inspect your project dependencies using npm:
npm ls react-dom
Analyze the terminal output to locate any version of React dom in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 16.1.2), your application is affected.
Note: The npm ls react-dom 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In React dom, 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-2018-6341 Affected React dom Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
react-dom
|
npm |
≥ 16.1.0
< 16.1.2
|
16.1.2
|
|
react-dom
|
npm |
≥ 16.0.0
< 16.0.1
All 1 versions
16.0.0
|
16.0.1
|
|
react-dom
|
npm |
≥ 16.2.0
< 16.2.1
All 1 versions
16.2.0
|
16.2.1
|
|
react-dom
|
npm |
≥ 16.3.0
< 16.3.3
|
16.3.3
|
|
react-dom
|
npm |
≥ 16.4.0
< 16.4.2
|
16.4.2
|
References
Frequently Asked Questions
What is CVE-2018-6341?
Which React dom versions are affected?
What version fixes CVE-2018-6341?
Is react-dom affected?
What is the CVSS score of CVE-2018-6341?
What CWE is associated with CVE-2018-6341?
How can I check npm dependencies for CVE-2018-6341?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mvjj-gqq2-p4hw",
"modified" : "2023-09-13T19:45:25Z",
"published" : "2019-01-04T19:05:35Z",
"aliases" : [ "CVE-2018-6341" ],
"summary" : "Cross-Site Scripting in react-dom",
"details" : "Affected versions of `react-dom` are vulnerable to Cross-Site Scripting (XSS). The package fails to validate attribute names in HTML tags which may lead to Cross-Site Scripting in specific scenarios. This may allow attackers to execute arbitrary JavaScript in the victim's browser. To be affected by this vulnerability, the application needs to:\n- be a server-side React app\n- be rendered to HTML using `ReactDOMServer`\n- include an attribute name from user input in an HTML tag\n\n\n## Recommendation\n\nIf you are using `react-dom` 16.0.x, upgrade to 16.0.1 or later. \nIf you are using `react-dom` 16.1.x, upgrade to 16.1.2 or later. \nIf you are using `react-dom` 16.2.x, upgrade to 16.2.1 or later. \nIf you are using `react-dom` 16.3.x, upgrade to 16.3.3 or later. \nIf you are using `react-dom` 16.4.x, upgrade to 16.4.2 or later.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "react-dom"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.0.0"
}, {
"fixed" : "16.0.1"
} ]
} ],
"versions" : [ "16.0.0" ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "react-dom"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.1.0"
}, {
"fixed" : "16.1.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "react-dom"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.2.0"
}, {
"fixed" : "16.2.1"
} ]
} ],
"versions" : [ "16.2.0" ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "react-dom"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.3.0"
}, {
"fixed" : "16.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "react-dom"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "16.4.0"
}, {
"fixed" : "16.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-6341"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-mvjj-gqq2-p4hw"
}, {
"type" : "WEB",
"url" : "https://reactjs.org/blog/2018/08/01/react-v-16-4-2.html"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/npm:react-dom:20180802"
}, {
"type" : "WEB",
"url" : "https://twitter.com/reactjs/status/1024745321987887104"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/1421"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:47:15Z",
"nvd_published_at" : null
}
}