CVE-2021-32662: @backstage/techdocs common Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-pgf8-28gg-vpr6
CVSS 6.5
CWE-22
Published
Advisory Summary

CVE-2021-32662 is a MODERATE (CVSS 6.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @backstage/techdocs common libraries in the npm ecosystem. The issue involves path traversal. Remediation is available by upgrading affected packages to version 0.6.3.

CVE-2021-32662 at a Glance

CVE Identifier CVE-2021-32662
GHSA Identifier GHSA-pgf8-28gg-vpr6
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @backstage/techdocs common
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.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:U/C:H/I:N/A:N).

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

How to Fix CVE-2021-32662

To remediate this vulnerability, upgrade all affected @backstage/techdocs common 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/techdocs-common fixed: 0.6.3
npm install @backstage/techdocs-common@0.6.3
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/techdocs-common

How to Check if You Are Affected

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

npm ls @backstage/techdocs-common

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

Note: The npm ls @backstage/techdocs-common 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/techdocs common, 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 could read sensitive files from the environment where TechDocs documentation is built and published by setting a particular path for `docs_dir` in `mkdocs.yml`. These files would then be available over the TechDocs backend API. This vulnerability is mitigated by the fact that an attacker would need access to modify the `mkdocs.yml` in the documentation source code, and would also need access to the TechDocs backend API. ### Patches The vulnerability is patched in the `0.6.3` release of `@backstage/techdocs-common`. ### 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-32662 Affected @backstage/techdocs common Versions

1 component(s)
Fixed Versions:
0.6.3
Product / Package Ecosystem Affected Versions Fixed Version
@backstage/techdocs-common
npm
< 0.6.3
0.6.3

References

Frequently Asked Questions

What is CVE-2021-32662?
CVE-2021-32662 is a security vulnerability in @backstage/techdocs common involving Path traversal under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @backstage/techdocs common versions are affected?
Affected versions include releases prior to 0.6.3 across affected packages: @backstage/techdocs-common.
What version fixes CVE-2021-32662?
Upgrading to 0.6.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @backstage/techdocs-common affected?
Yes, @backstage/techdocs-common is affected in releases prior to 0.6.3. Upgrade your dependency to 0.6.3 or later.
What is the CVSS score of CVE-2021-32662?
CVE-2021-32662 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-32662?
CVE-2021-32662 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-32662?
Run the dependency tree command: 'npm ls @backstage/techdocs-common'. 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-pgf8-28gg-vpr6",
  "modified" : "2021-06-07T18:55:30Z",
  "published" : "2021-06-04T19:09:20Z",
  "aliases" : [ "CVE-2021-32662" ],
  "summary" : "Path traversal",
  "details" : "### Impact\n\nA malicious actor could read sensitive files from the environment where TechDocs documentation is built and published by setting a particular path for `docs_dir` in `mkdocs.yml`. These files would then be available over the TechDocs backend API.\n\nThis vulnerability is mitigated by the fact that an attacker would need access to modify the `mkdocs.yml` in the documentation source code, and would also need access to the TechDocs backend API.\n\n### Patches\n\nThe vulnerability is patched in the `0.6.3` release of `@backstage/techdocs-common`.\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:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@backstage/techdocs-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/security/advisories/GHSA-pgf8-28gg-vpr6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32662"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/commit/8cefadca04cbf01d0394b0cb1983247e5f1d6208"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/releases/tag/release-2021-05-27"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-03T22:01:05Z",
    "nvd_published_at" : "2021-06-03T22:15:00Z"
  }
}