CVE-2021-21298: @node red/runtime Path Traversal Vulnerability
LOWCVE-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
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.
npm install @node-red/runtime@1.2.8
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
CVE-2021-21298 Affected @node red/runtime Versions
1 component(s)| 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?
Which @node red/runtime versions are affected?
What version fixes CVE-2021-21298?
Is @node-red/runtime affected?
What CWE is associated with CVE-2021-21298?
How can I check npm dependencies for CVE-2021-21298?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}