CVE-2018-6342: React dev utils Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-29gp-92wp-94q8
CWE-78
Published
Advisory Summary

CVE-2018-6342 is a HIGH remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting React dev utils libraries in the npm ecosystem. The issue involves react-dev-utils on windows vulnerable to remote code execution. Remediation is available by upgrading affected packages to version 1.0.4, 2.0.2, 3.1.2, 4.2.2, 5.0.2.

CVE-2018-6342 at a Glance

CVE Identifier CVE-2018-6342
GHSA Identifier GHSA-29gp-92wp-94q8
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product React dev utils
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2018-6342

To remediate this vulnerability, upgrade all affected React dev utils 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-dev-utils fixed: 1.0.4
npm install react-dev-utils@1.0.4
react-dev-utils fixed: 2.0.2
npm install react-dev-utils@2.0.2
react-dev-utils fixed: 3.1.2
npm install react-dev-utils@3.1.2
react-dev-utils fixed: 4.2.2
npm install react-dev-utils@4.2.2
react-dev-utils fixed: 5.0.2
npm install react-dev-utils@5.0.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-dev-utils

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2018-6342, inspect your project dependencies using npm:

npm ls react-dev-utils

Analyze the terminal output to locate any version of React dev utils in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.4), your application is affected.

Note: The npm ls react-dev-utils 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In React dev utils, 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

`react-dev-utils` on Windows is vulnerable to remote code execution. ## Recommendation Update to one of the following versions, depending on the release line that you are using. - 1.0.4 - 2.0.2 - 3.1.2 - 4.2.2 - 5.0.2 - 6.0.0-next.a671462c

CVE-2018-6342 Affected React dev utils Versions

5 component(s)
Fixed Versions:
1.0.42.0.23.1.24.2.25.0.2
Product / Package Ecosystem Affected Versions Fixed Version
react-dev-utils
npm
≥ 1.0.0
< 1.0.4
1.0.4
react-dev-utils
npm
≥ 2.0.0
< 2.0.2
2.0.2
react-dev-utils
npm
≥ 3.0.0
< 3.1.2
3.1.2
react-dev-utils
npm
≥ 4.0.0
< 4.2.2
4.2.2
react-dev-utils
npm
≥ 5.0.0
< 5.0.2
5.0.2

References

Frequently Asked Questions

What is CVE-2018-6342?
CVE-2018-6342 is a security vulnerability in React dev utils involving react-dev-utils on Windows vulnerable to Remote Code Execution under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which React dev utils versions are affected?
Affected versions include releases prior to 1.0.4, 2.0.2, 3.1.2, 4.2.2, 5.0.2 across affected packages: react-dev-utils.
What version fixes CVE-2018-6342?
Upgrading to 1.0.4, 2.0.2, 3.1.2, 4.2.2, 5.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is react-dev-utils affected?
Yes, react-dev-utils is affected in releases prior to 1.0.4, 2.0.2, 3.1.2, 4.2.2, 5.0.2. Upgrade your dependency to 1.0.4, 2.0.2, 3.1.2, 4.2.2, 5.0.2 or later.
What CWE is associated with CVE-2018-6342?
CVE-2018-6342 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2018-6342?
Run the dependency tree command: 'npm ls react-dev-utils'. 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-29gp-92wp-94q8",
  "modified" : "2022-08-03T19:36:45Z",
  "published" : "2019-01-04T17:41:20Z",
  "aliases" : [ "CVE-2018-6342" ],
  "summary" : "react-dev-utils on Windows vulnerable to Remote Code Execution",
  "details" : "`react-dev-utils` on Windows is vulnerable to remote code execution.\n\n\n## Recommendation\n\nUpdate to one of the following versions, depending on the release line that you are using.\n- 1.0.4\n- 2.0.2\n- 3.1.2\n- 4.2.2\n- 5.0.2\n- 6.0.0-next.a671462c",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-6342"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebook/create-react-app/pull/4866"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-29gp-92wp-94q8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/facebook/create-react-app"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebook/create-react-app/releases/tag/v1.1.5"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/695"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T20:51:46Z",
    "nvd_published_at" : "2018-12-31T22:29:00Z"
  }
}