CVE-2022-0087: @keystone 6/auth Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-hrgx-7j6v-xj82
CVSS 7.1
CWE-79
Published
Advisory Summary

CVE-2022-0087 is a HIGH (CVSS 7.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @keystone 6/auth libraries in the npm ecosystem. The issue involves reflected cross-site scripting (xss) vulnerability. Remediation is available by upgrading affected packages to version 1.0.2.

CVE-2022-0087 at a Glance

CVE Identifier CVE-2022-0087
GHSA Identifier GHSA-hrgx-7j6v-xj82
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @keystone 6/auth
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.1

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

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 Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2022-0087

To remediate this vulnerability, upgrade all affected @keystone 6/auth dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@keystone-6/auth fixed: 1.0.2
npm install @keystone-6/auth@1.0.2
@keystone-next/auth fixed: Latest secure release
npm install @keystone-next/auth@Latest secure release
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 @keystone-6/auth

How to Check if You Are Affected

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

npm ls @keystone-6/auth

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

Note: The npm ls @keystone-6/auth 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 @keystone 6/auth, 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

This security advisory relates to a capability for an attacker to exploit a reflected cross-site scripting vulnerability when using the `@keystone-6/auth` package. #### Impact The vulnerability can impact users of the administration user interface when following an untrusted link to the `signin` or `init` page. This is a targeted attack and may present itself in the form of phishing and or chained in conjunction with some other vulnerability. ## Vulnerability mitigation Please upgrade to `@keystone-6/auth >= 1.0.2`, where this vulnerability has been closed. If you are using `@keystone-next/auth`, we **strongly** recommend you upgrade to `@keystone-6`. ### Workarounds If for some reason you cannot upgrade the dependencies in software, you could alternatively - disable the administration user interface, or - if using a reverse-proxy, strip query parameters when accessing the administration interface ### References https://owasp.org/www-community/attacks/xss/ Thanks to Shivansh Khari (@Shivansh-Khari) for discovering and reporting this vulnerability

CVE-2022-0087 Affected @keystone 6/auth Versions

2 component(s)
Fixed Versions:
1.0.2
Product / Package Ecosystem Affected Versions Fixed Version
@keystone-6/auth
npm
< 1.0.2
1.0.2
@keystone-next/auth
npm
≤ 37.0.0

References

Frequently Asked Questions

What is CVE-2022-0087?
CVE-2022-0087 is a security vulnerability in @keystone 6/auth involving Reflected cross-site scripting (XSS) vulnerability under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @keystone 6/auth versions are affected?
Affected versions include releases prior to 1.0.2 across affected packages: @keystone-6/auth, @keystone-next/auth.
What version fixes CVE-2022-0087?
Upgrading to 1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @keystone-6/auth affected?
Yes, @keystone-6/auth is affected in releases prior to 1.0.2. Upgrade your dependency to 1.0.2 or later.
Is @keystone-next/auth affected?
Yes, @keystone-next/auth is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2022-0087?
CVE-2022-0087 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2022-0087?
CVE-2022-0087 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-2022-0087?
Run the dependency tree command: 'npm ls @keystone-6/auth'. 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-hrgx-7j6v-xj82",
  "modified" : "2022-01-19T17:42:16Z",
  "published" : "2022-01-12T21:55:40Z",
  "aliases" : [ "CVE-2022-0087" ],
  "summary" : "Reflected cross-site scripting (XSS) vulnerability",
  "details" : "This security advisory relates to a capability for an attacker to exploit a reflected cross-site scripting vulnerability when using the `@keystone-6/auth` package.\n\n#### Impact\nThe vulnerability can impact users of the administration user interface when following an untrusted link to the `signin` or `init` page.\nThis is a targeted attack and may present itself in the form of phishing and or chained in conjunction with some other vulnerability.\n\n## Vulnerability mitigation\nPlease upgrade to `@keystone-6/auth >= 1.0.2`, where this vulnerability has been closed.\nIf you are using `@keystone-next/auth`,  we **strongly** recommend you upgrade to `@keystone-6`.\n\n### Workarounds\nIf for some reason you cannot upgrade the dependencies in software, you could alternatively\n\n- disable the administration user interface, or \n- if using a reverse-proxy, strip query parameters when accessing the administration interface\n\n### References\nhttps://owasp.org/www-community/attacks/xss/\n\nThanks to Shivansh Khari (@Shivansh-Khari) for discovering and reporting this vulnerability",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@keystone-6/auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@keystone-next/auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "37.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/keystonejs/keystone/security/advisories/GHSA-hrgx-7j6v-xj82"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-0087"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keystonejs/keystone/commit/96bf833a23b1a0a5d365cf394467a943cc481b38"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/keystonejs/keystone"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/c9d7374f-2cb9-4bac-9c90-a965942f413e"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-10T21:45:34Z",
    "nvd_published_at" : "2022-01-12T00:15:00Z"
  }
}