CVE-2021-21298: @node red/runtime Path Traversal Vulnerability

LOW
Advisory Identifier: GHSA-m33v-338h-4v9f
CWE-22
Published
Advisory Summary

CVE-2021-21298 is a LOW path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @node red/runtime libraries in the npm ecosystem. The issue involves path traversal in node-red. Remediation is available by upgrading affected packages to version 1.2.8.

CVE-2021-21298 at a Glance

CVE Identifier CVE-2021-21298
GHSA Identifier GHSA-m33v-338h-4v9f
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @node red/runtime
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2021-21298

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-21298, 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. 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 This vulnerability allows arbitrary path traversal via the Projects API. If the Projects feature is enabled, a user with `projects.read` permission is able to access any file via the Projects API. ### Patches The issue has been patched in Node-RED 1.2.8 ### Workarounds The vulnerability applies only to the Projects feature which is not enabled by default in Node-RED. The primary workaround is not give untrusted users read access to the Node-RED editor. ### 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-21298 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-21298?
CVE-2021-21298 is a security vulnerability in @node red/runtime involving Path traversal in Node-Red under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
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-21298?
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 CWE is associated with CVE-2021-21298?
CVE-2021-21298 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2021-21298?
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-m33v-338h-4v9f",
  "modified" : "2021-02-26T16:23:34Z",
  "published" : "2021-02-26T16:31:23Z",
  "aliases" : [ "CVE-2021-21298" ],
  "summary" : "Path traversal in Node-Red",
  "details" : "### Impact\n\nThis vulnerability allows arbitrary path traversal via the Projects API.\n\nIf the Projects feature is enabled, a user with `projects.read` permission is able to access any file via the Projects API.\n\n### Patches\n\nThe issue has been patched in Node-RED 1.2.8\n\n### Workarounds\n\nThe vulnerability applies only to the Projects feature which is not enabled by default in Node-RED.\n\nThe primary workaround is not give untrusted users read access to the Node-RED editor.\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" : [ ],
  "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-m33v-338h-4v9f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21298"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-red/node-red/commit/74db3e17d075f23d9c95d7871586cf461524c456"
  }, {
    "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/runtime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-02-26T16:23:34Z",
    "nvd_published_at" : "2021-02-26T17:15:00Z"
  }
}