CVE-2021-32660: @backstage/techdocs common Script Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-pwhf-39xg-4rxw
CVSS 6.8
CWE-434 CWE-77
Published
Advisory Summary

CVE-2021-32660 is a MODERATE (CVSS 6.8) script injection vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting @backstage/techdocs common libraries in the npm ecosystem. The issue involves script injection. Remediation is available by upgrading affected packages to version 0.6.4.

CVE-2021-32660 at a Glance

CVE Identifier CVE-2021-32660
GHSA Identifier GHSA-pwhf-39xg-4rxw
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-434: Unrestricted Upload of File with Dangerous Type
Affected Product @backstage/techdocs common
Package Ecosystem npm
Published Date
Last Updated

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:R/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2021-32660

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.4
npm install @backstage/techdocs-common@0.6.4
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-32660, 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.4), 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-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. 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 internal actor is able to upload documentation content with malicious scripts. These scripts would normally be sanitized by the TechDocs frontend, but by tricking a user to visit the content via the TechDocs API, the content sanitazion will be bypassed. If the TechDocs API is hosted on the same origin as the Backstage app or other backend plugins, this may give access to sensitive data. The ability to upload malicious content may be limited by internal code review processes, unless the chosen TechDocs deployment method is to use an object store and the actor has access to upload files directly to that store. ### Patches The vulnerability is patched in the `0.6.4` 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-32660 Affected @backstage/techdocs common Versions

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

References

Frequently Asked Questions

What is CVE-2021-32660?
CVE-2021-32660 is a security vulnerability in @backstage/techdocs common involving Script injection under CWE-434: Unrestricted Upload of File with Dangerous Type.
Which @backstage/techdocs common versions are affected?
Affected versions include releases prior to 0.6.4 across affected packages: @backstage/techdocs-common.
What version fixes CVE-2021-32660?
Upgrading to 0.6.4 (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.4. Upgrade your dependency to 0.6.4 or later.
What is the CVSS score of CVE-2021-32660?
CVE-2021-32660 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-32660?
CVE-2021-32660 is classified under CWE-434: Unrestricted Upload of File with Dangerous Type (The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.).
How can I check npm dependencies for CVE-2021-32660?
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-pwhf-39xg-4rxw",
  "modified" : "2021-06-04T19:23:33Z",
  "published" : "2021-06-04T19:09:35Z",
  "aliases" : [ "CVE-2021-32660" ],
  "summary" : "Script injection",
  "details" : "### Impact\n\nA malicious internal actor is able to upload documentation content with malicious scripts. These scripts would normally be sanitized by the TechDocs frontend, but by tricking a user to visit the content via the TechDocs API, the content sanitazion will be bypassed. If the TechDocs API is hosted on the same origin as the Backstage app or other backend plugins, this may give access to sensitive data.\n\nThe ability to upload malicious content may be limited by internal code review processes, unless the chosen TechDocs deployment method is to use an object store and the actor has access to upload files directly to that store.\n\n### Patches\n\nThe vulnerability is patched in the `0.6.4` 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:H/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@backstage/techdocs-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/security/advisories/GHSA-pwhf-39xg-4rxw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32660"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/commit/aad98c544e59369901fe9e0a85f6357644dceb5c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/releases/tag/release-2021-06-03"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-434", "CWE-77" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-03T22:02:53Z",
    "nvd_published_at" : "2021-06-03T17:15:00Z"
  }
}