CVE-2021-24033: React dev utils React-dev-utils OS Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-5q6m-3h65-w53x
CVSS 5.6
CWE-78
Published
Advisory Summary

CVE-2021-24033 is a MODERATE (CVSS 5.6) react-dev-utils os command injection 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 os command injection in function `getprocessforport`. Remediation is available by upgrading affected packages to version 11.0.4.

CVE-2021-24033 at a Glance

CVE Identifier CVE-2021-24033
GHSA Identifier GHSA-5q6m-3h65-w53x
Severity MODERATE
CVSS v3.1 Base Score 5.6
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

Security Impact

CVSS: 5.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2021-24033

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: 11.0.4
npm install react-dev-utils@11.0.4
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-2021-24033, 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 11.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 prior to v11.0.4 exposes a function, `getProcessForPort`, where an input argument is concatenated into a command string to be executed. This function is typically used from react-scripts (in Create React App projects), where the usage is safe. Only when this function is manually invoked with user-provided values (ie: by custom code) is there the potential for command injection. If you're consuming it from react-scripts then this issue does not affect you.

CVE-2021-24033 Affected React dev utils Versions

1 component(s)
Fixed Versions:
11.0.4
Product / Package Ecosystem Affected Versions Fixed Version
react-dev-utils
npm
≥ 0.4.0
< 11.0.4
11.0.4

References

Frequently Asked Questions

What is CVE-2021-24033?
CVE-2021-24033 is a security vulnerability in React dev utils involving react-dev-utils OS Command Injection in function `getProcessForPort` 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 11.0.4 across affected packages: react-dev-utils.
What version fixes CVE-2021-24033?
Upgrading to 11.0.4 (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 11.0.4. Upgrade your dependency to 11.0.4 or later.
What is the CVSS score of CVE-2021-24033?
CVE-2021-24033 has a CVSS v3.1 base score of 5.6 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2021-24033?
CVE-2021-24033 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-2021-24033?
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-5q6m-3h65-w53x",
  "modified" : "2022-08-03T17:21:06Z",
  "published" : "2021-03-11T22:26:09Z",
  "aliases" : [ "CVE-2021-24033" ],
  "summary" : "react-dev-utils OS Command Injection in function `getProcessForPort`",
  "details" : "react-dev-utils prior to v11.0.4 exposes a function, `getProcessForPort`, where an input argument is concatenated into a command string to be executed. This function is typically used from react-scripts (in Create React App projects), where the usage is safe. Only when this function is manually invoked with user-provided values (ie: by custom code) is there the potential for command injection. If you're consuming it from react-scripts then this issue does not affect you.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "react-dev-utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.4.0"
      }, {
        "fixed" : "11.0.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-24033"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebook/create-react-app/pull/10644"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/facebook/create-react-app/commit/f5e415f3a5b66f07dcc60aba1b445fa7cda97268"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/facebook/create-react-app"
  }, {
    "type" : "WEB",
    "url" : "https://www.facebook.com/security/advisories/cve-2021-24033"
  }, {
    "type" : "WEB",
    "url" : "https://www.huntr.dev/bounties/1-npm-react-dev-utils"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-11T22:18:08Z",
    "nvd_published_at" : "2021-03-09T01:15:00Z"
  }
}