CVE-2021-21297: @node red/runtime Prototype Pollution Vulnerability

HIGH
Advisory Identifier: GHSA-xp9c-82x8-7f67
CVSS 7.7
CWE-1321 CWE-915
Published
Advisory Summary

CVE-2021-21297 is a HIGH (CVSS 7.7) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting @node red/runtime libraries in the npm ecosystem. The issue involves prototype pollution in node-red. Remediation is available by upgrading affected packages to version 1.2.8.

CVE-2021-21297 at a Glance

CVE Identifier CVE-2021-21297
GHSA Identifier GHSA-xp9c-82x8-7f67
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product @node red/runtime
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.7

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

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

How to Fix CVE-2021-21297

To remediate this vulnerability, upgrade all affected @node red/runtime dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@node-red/runtime fixed: 1.2.8
npm install @node-red/runtime@1.2.8
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 @node-red/runtime

How to Check if You Are Affected

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

npm ls @node-red/runtime

Analyze the terminal output to locate any version of @node red/runtime in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.8), your application is affected.

Note: The npm ls @node-red/runtime 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In @node red/runtime, 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

### Impact Node-RED 1.2.7 and earlier contains a Prototype Pollution vulnerability in the admin API. A badly formed request can modify the prototype of the default JavaScript Object with the potential to affect the default behaviour of the Node-RED runtime. ### Patches The vulnerability is patched in the 1.2.8 release. ### Workarounds A workaround is to ensure only authorised users are able to access the editor url. ### For more information If you have any questions or comments about this advisory: * Email us at [team@nodered.org](mailto:team@nodered.org) ### Acknowledgements Thanks to the Tencent Woodpecker Security Team for disclosing this vulnerability.

CVE-2021-21297 Affected @node red/runtime Versions

1 component(s)
Fixed Versions:
1.2.8
Product / Package Ecosystem Affected Versions Fixed Version
@node-red/runtime
npm
< 1.2.8
1.2.8

References

Frequently Asked Questions

What is CVE-2021-21297?
CVE-2021-21297 is a security vulnerability in @node red/runtime involving Prototype Pollution in Node-Red under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which @node red/runtime versions are affected?
Affected versions include releases prior to 1.2.8 across affected packages: @node-red/runtime.
What version fixes CVE-2021-21297?
Upgrading to 1.2.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @node-red/runtime affected?
Yes, @node-red/runtime is affected in releases prior to 1.2.8. Upgrade your dependency to 1.2.8 or later.
What is the CVSS score of CVE-2021-21297?
CVE-2021-21297 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2021-21297?
CVE-2021-21297 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2021-21297?
Run the dependency tree command: 'npm ls @node-red/runtime'. 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-xp9c-82x8-7f67",
  "modified" : "2021-09-22T13:55:00Z",
  "published" : "2021-02-26T16:31:05Z",
  "aliases" : [ "CVE-2021-21297" ],
  "summary" : "Prototype Pollution in Node-Red",
  "details" : "### Impact\n\nNode-RED 1.2.7 and earlier contains a Prototype Pollution vulnerability in the admin API. A badly formed request can modify the prototype of the default JavaScript Object with the potential to affect the default behaviour of the Node-RED runtime.\n\n### Patches\n\nThe vulnerability is patched in the 1.2.8 release.\n\n### Workarounds\n\nA workaround is to ensure only authorised users are able to access the editor url.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Email us at [team@nodered.org](mailto:team@nodered.org)\n\n### Acknowledgements\n\nThanks to the Tencent Woodpecker Security Team for disclosing this vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@node-red/runtime"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/node-red/node-red/security/advisories/GHSA-xp9c-82x8-7f67"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21297"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/node-red/node-red"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-red/node-red/releases/tag/1.2.8"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/@node-red/editor-api"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/@node-red/runtime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-915" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-02-26T16:22:38Z",
    "nvd_published_at" : "2021-02-26T17:15:00Z"
  }
}