Vulnerabilities in pkg:npm/react-dom

PACKAGE
Advisory Identifier: GHSA-mvjj-gqq2-p4hw
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/react-dom

1 Known Advisory Record(s)

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

CVE Identifier CVE-2018-6341
GHSA Identifier GHSA-mvjj-gqq2-p4hw
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product React dom
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

react-dom fixed: 16.1.2
npm install react-dom@16.1.2
react-dom fixed: 16.0.1
npm install react-dom@16.0.1
react-dom fixed: 16.2.1
npm install react-dom@16.2.1
react-dom fixed: 16.3.3
npm install react-dom@16.3.3
react-dom fixed: 16.4.2
npm install react-dom@16.4.2
Verify Direct and Transitive Dependencies

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

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: - be a server-side React app - be rendered to HTML using `ReactDOMServer` - include an attribute name from user input in an HTML tag ## Recommendation If you are using `react-dom` 16.0.x, upgrade to 16.0.1 or later. If you are using `react-dom` 16.1.x, upgrade to 16.1.2 or later. If you are using `react-dom` 16.2.x, upgrade to 16.2.1 or later. If you are using `react-dom` 16.3.x, upgrade to 16.3.3 or later. If you are using `react-dom` 16.4.x, upgrade to 16.4.2 or later.

CVE-2018-6341 Affected React dom Versions

5 component(s)
Fixed Versions:
16.1.216.0.116.2.116.3.316.4.2
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?
CVE-2018-6341 is a security vulnerability in React dom involving Cross-Site Scripting in react-dom under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which React dom versions are affected?
Affected versions include releases prior to 16.1.2, 16.0.1, 16.2.1, 16.3.3, 16.4.2 across affected packages: react-dom.
What version fixes CVE-2018-6341?
Upgrading to 16.1.2, 16.0.1, 16.2.1, 16.3.3, 16.4.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is react-dom affected?
Yes, react-dom is affected in releases prior to 16.1.2, 16.0.1, 16.2.1, 16.3.3, 16.4.2. Upgrade your dependency to 16.1.2, 16.0.1, 16.2.1, 16.3.3, 16.4.2 or later.
What is the CVSS score of CVE-2018-6341?
CVE-2018-6341 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2018-6341?
CVE-2018-6341 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (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.).
How can I check npm dependencies for CVE-2018-6341?
Run the dependency tree command: 'npm ls react-dom'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}