CVE-2021-43783: @backstage/plugin scaffolder backend Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-mg3m-f475-28hv
CVSS 8.5
CWE-22
Published
Advisory Summary

CVE-2021-43783 is a HIGH (CVSS 8.5) 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.14.

CVE-2021-43783 at a Glance

CVE Identifier CVE-2021-43783
GHSA Identifier GHSA-mg3m-f475-28hv
Severity HIGH
CVSS v3.1 Base Score 8.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @backstage/plugin scaffolder backend
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.5

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:L).

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 Low (A:L)

How to Fix CVE-2021-43783

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.

@backstage/plugin-scaffolder-backend fixed: 0.15.14
npm install @backstage/plugin-scaffolder-backend@0.15.14
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 @backstage/plugin-scaffolder-backend

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-43783, 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.14), 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

### Impact A malicious actor with write access to a registered scaffolder template is able to manipulate the template in a way that writes files to arbitrary paths on the scaffolder-backend host instance. This vulnerability can in some situation also be exploited through user input when executing a template, meaning you do not need write access to the templates. This method will not allow the attacker to control the contents of the injected file however, unless the template is also crafted in a specific way that gives control of the file contents. ### Patches This vulnerability is fixed in version `0.15.14` of the `@backstage/plugin-scaffolder-backend`. ### Workarounds This attack is mitigated by restricting access and requiring reviews when registering or modifying scaffolder templates. ### For more information If you have any questions or comments about this advisory: * Open an issue in the [Backstage repository](https://github.com/backstage/backstage) * Visit our chat, linked to in [Backstage README](https://github.com/backstage/backstage)

CVE-2021-43783 Affected @backstage/plugin scaffolder backend Versions

1 component(s)
Fixed Versions:
0.15.14
Product / Package Ecosystem Affected Versions Fixed Version
@backstage/plugin-scaffolder-backend
npm
< 0.15.14
0.15.14

References

Frequently Asked Questions

What is CVE-2021-43783?
CVE-2021-43783 is a security vulnerability in @backstage/plugin scaffolder backend involving Path Traversal in @backstage/plugin-scaffolder-backend under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @backstage/plugin scaffolder backend versions are affected?
Affected versions include releases prior to 0.15.14 across affected packages: @backstage/plugin-scaffolder-backend.
What version fixes CVE-2021-43783?
Upgrading to 0.15.14 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @backstage/plugin-scaffolder-backend affected?
Yes, @backstage/plugin-scaffolder-backend is affected in releases prior to 0.15.14. Upgrade your dependency to 0.15.14 or later.
What is the CVSS score of CVE-2021-43783?
CVE-2021-43783 has a CVSS v3.1 base score of 8.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:L.
What CWE is associated with CVE-2021-43783?
CVE-2021-43783 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-43783?
Run the dependency tree command: 'npm ls @backstage/plugin-scaffolder-backend'. 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-mg3m-f475-28hv",
  "modified" : "2021-11-29T20:22:25Z",
  "published" : "2021-12-01T18:28:51Z",
  "aliases" : [ "CVE-2021-43783" ],
  "summary" : "Path Traversal in @backstage/plugin-scaffolder-backend",
  "details" : "### Impact\nA malicious actor with write access to a registered scaffolder template is able to manipulate the template in a way that writes files to arbitrary paths on the scaffolder-backend host instance.\n\nThis vulnerability can in some situation also be exploited through user input when executing a template, meaning you do not need write access to the templates. This method will not allow the attacker to control the contents of the injected file however, unless the template is also crafted in a specific way that gives control of the file contents.\n\n### Patches\nThis vulnerability is fixed in version `0.15.14` of the `@backstage/plugin-scaffolder-backend`.\n\n### Workarounds\nThis attack is mitigated by restricting access and requiring reviews when registering or modifying scaffolder templates.\n\n### For more information\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)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@backstage/plugin-scaffolder-backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.15.14"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/security/advisories/GHSA-mg3m-f475-28hv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43783"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/commit/f9352ab606367cd9efc6ff048915c70ed3013b7f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/backstage/backstage"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-29T20:22:25Z",
    "nvd_published_at" : "2021-11-29T20:15:00Z"
  }
}