CVE-2021-41151: @backstage/plugin scaffolder backend Path Traversal Vulnerability
MODERATECVE-2021-41151 is a MODERATE (CVSS 6.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @backstage/plugin scaffolder backend libraries in the npm ecosystem. The issue involves path traversal in @backstage/plugin-scaffolder-backend. Remediation is available by upgrading affected packages to version 0.15.9.
CVE-2021-41151 at a Glance
Security Impact
CVSS: 6.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N).
How to Fix CVE-2021-41151
To remediate this vulnerability, upgrade all affected @backstage/plugin scaffolder backend 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 @backstage/plugin-scaffolder-backend@0.15.9
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @backstage/plugin-scaffolder-backend
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-41151, inspect your project dependencies using npm:
npm ls @backstage/plugin-scaffolder-backend
Analyze the terminal output to locate any version of @backstage/plugin scaffolder backend in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.15.9), your application is affected.
Note: The npm ls @backstage/plugin-scaffolder-backend 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 @backstage/plugin scaffolder backend, 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-41151 Affected @backstage/plugin scaffolder backend Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@backstage/plugin-scaffolder-backend
|
npm |
≥ 0.9.4
< 0.15.9
|
0.15.9
|
References
Frequently Asked Questions
What is CVE-2021-41151?
Which @backstage/plugin scaffolder backend versions are affected?
What version fixes CVE-2021-41151?
Is @backstage/plugin-scaffolder-backend affected?
What is the CVSS score of CVE-2021-41151?
What CWE is associated with CVE-2021-41151?
How can I check npm dependencies for CVE-2021-41151?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pvv8-8fx9-h673",
"modified" : "2021-10-25T20:07:48Z",
"published" : "2021-10-19T15:28:03Z",
"aliases" : [ "CVE-2021-41151" ],
"summary" : "Path Traversal in @backstage/plugin-scaffolder-backend ",
"details" : "### Impact\n\nA malicious actor could read sensitive files from the environment where Scaffolder tasks are run. The attack is executed by crafting a custom Scaffolder template with a `publish:github:pull-request` action using a particular source path. When the template is executed the sensitive files would be included in the published pull request.\n\nThis vulnerability is mitigated by the fact that an attacker would need access to create and register templates in the Backstage catalog, and that the attack is very visible given that the exfiltration happens via a pull request.\n\n### Patches\n\nThe vulnerability is patched in the `0.15.9` release of `@backstage/plugin-scaffolder-backend`.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in the [Backstage repository](https://github.com/backstage/backstage)\n* Visit our chat, linked to in [Backstage README](https://github.com/backstage/backstage)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@backstage/plugin-scaffolder-backend"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.9.4"
}, {
"fixed" : "0.15.9"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/backstage/backstage/security/advisories/GHSA-pvv8-8fx9-h673"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41151"
}, {
"type" : "WEB",
"url" : "https://github.com/backstage/backstage/commit/6968962c920508eae19a4c1c200fa2c8980a4006"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/backstage/backstage"
}, {
"type" : "WEB",
"url" : "https://github.com/backstage/backstage/releases/tag/release-2021-10-16"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-10-18T20:47:02Z",
"nvd_published_at" : "2021-10-18T21:15:00Z"
}
}