CVE-2021-43776: @backstage/plugin auth backend Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-w7fj-336r-vw49
CVSS 7.4
CWE-79
Published
Advisory Summary

CVE-2021-43776 is a HIGH (CVSS 7.4) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @backstage/plugin auth backend libraries in the npm ecosystem. The issue involves cross-site scripting vulnerability in @backstage/plugin-auth-backend. Remediation is available by upgrading affected packages to version 0.4.9.

CVE-2021-43776 at a Glance

CVE Identifier CVE-2021-43776
GHSA Identifier GHSA-w7fj-336r-vw49
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @backstage/plugin auth backend
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N).

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

How to Fix CVE-2021-43776

To remediate this vulnerability, upgrade all affected @backstage/plugin auth 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-auth-backend fixed: 0.4.9
npm install @backstage/plugin-auth-backend@0.4.9
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-auth-backend

How to Check if You Are Affected

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

npm ls @backstage/plugin-auth-backend

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

Note: The npm ls @backstage/plugin-auth-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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In @backstage/plugin auth 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 This vulnerability allows a malicious actor to trick another user into visiting a vulnerable URL that executes an XSS attack. This attack can potentially allow the attacker to exfiltrate access tokens or other secrets from the user's browser. The default CSP does prevent this attack, but it is expected that some deployments have these policies disabled due to incompatibilities. ### Patches This is vulnerability is patched in version `0.4.9` of `@backstage/plugin-auth-backend`. ### 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-43776 Affected @backstage/plugin auth backend Versions

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

References

Frequently Asked Questions

What is CVE-2021-43776?
CVE-2021-43776 is a security vulnerability in @backstage/plugin auth backend involving Cross-Site Scripting vulnerability in @backstage/plugin-auth-backend under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @backstage/plugin auth backend versions are affected?
Affected versions include releases prior to 0.4.9 across affected packages: @backstage/plugin-auth-backend.
What version fixes CVE-2021-43776?
Upgrading to 0.4.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @backstage/plugin-auth-backend affected?
Yes, @backstage/plugin-auth-backend is affected in releases prior to 0.4.9. Upgrade your dependency to 0.4.9 or later.
What is the CVSS score of CVE-2021-43776?
CVE-2021-43776 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2021-43776?
CVE-2021-43776 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2021-43776?
Run the dependency tree command: 'npm ls @backstage/plugin-auth-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-w7fj-336r-vw49",
  "modified" : "2021-12-01T14:35:30Z",
  "published" : "2021-12-01T18:29:21Z",
  "aliases" : [ "CVE-2021-43776" ],
  "summary" : "Cross-Site Scripting vulnerability in @backstage/plugin-auth-backend",
  "details" : "### Impact\nThis vulnerability allows a malicious actor to trick another user into visiting a vulnerable URL that executes an XSS attack. This attack can potentially allow the attacker to exfiltrate access tokens or other secrets from the user's browser. The default CSP does prevent this attack, but it is expected that some deployments have these policies disabled due to incompatibilities.\n\n### Patches\nThis is vulnerability is patched in version `0.4.9` of `@backstage/plugin-auth-backend`.\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:N/UI:R/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@backstage/plugin-auth-backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/security/advisories/GHSA-w7fj-336r-vw49"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43776"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/backstage/backstage"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/tree/master/plugins/auth-backend"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-29T19:19:57Z",
    "nvd_published_at" : "2021-11-26T19:15:00Z"
  }
}