CVE-2024-23841: @apollo/experimental nextjs app support Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-rv8p-rr2h-fgpg
CVSS 8.2
CWE-80
Published
Advisory Summary

CVE-2024-23841 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting @apollo/experimental nextjs app support libraries in the npm ecosystem. The issue involves @apollo/experimental-nextjs-app-support cross-site scripting vulnerability. Remediation is available by upgrading affected packages to version 0.7.0.

CVE-2024-23841 at a Glance

CVE Identifier CVE-2024-23841
GHSA Identifier GHSA-rv8p-rr2h-fgpg
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
Affected Product @apollo/experimental nextjs app support
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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

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

How to Fix CVE-2024-23841

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

@apollo/experimental-nextjs-app-support fixed: 0.7.0
npm install @apollo/experimental-nextjs-app-support@0.7.0
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 @apollo/experimental-nextjs-app-support

How to Check if You Are Affected

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

npm ls @apollo/experimental-nextjs-app-support

Analyze the terminal output to locate any version of @apollo/experimental nextjs app support in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.0), your application is affected.

Note: The npm ls @apollo/experimental-nextjs-app-support 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-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In @apollo/experimental nextjs app support, 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 The @apollo/experimental-apollo-client-nextjs NPM package is vulnerable to a cross-site scripting vulnerability. This vulnerability arises from improper handling of untrusted input when @apollo/experimental-apollo-client-nextjs performs server-side rendering of HTML pages. To fix this vulnerability, we implemented appropriate escaping to prevent javascript injection into rendered pages. ### Patches To fix this issue, please update to version 0.7.0 or later. ### Workarounds There are no known workarounds for this issue. Please update to version 0.7.0

CVE-2024-23841 Affected @apollo/experimental nextjs app support Versions

1 component(s)
Fixed Versions:
0.7.0
Product / Package Ecosystem Affected Versions Fixed Version
@apollo/experimental-nextjs-app-support
npm
< 0.7.0
0.7.0

References

Frequently Asked Questions

What is CVE-2024-23841?
CVE-2024-23841 is a security vulnerability in @apollo/experimental nextjs app support involving @apollo/experimental-nextjs-app-support Cross-site Scripting vulnerability under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).
Which @apollo/experimental nextjs app support versions are affected?
Affected versions include releases prior to 0.7.0 across affected packages: @apollo/experimental-nextjs-app-support.
What version fixes CVE-2024-23841?
Upgrading to 0.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @apollo/experimental-nextjs-app-support affected?
Yes, @apollo/experimental-nextjs-app-support is affected in releases prior to 0.7.0. Upgrade your dependency to 0.7.0 or later.
What is the CVSS score of CVE-2024-23841?
CVE-2024-23841 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2024-23841?
CVE-2024-23841 is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages.).
How can I check npm dependencies for CVE-2024-23841?
Run the dependency tree command: 'npm ls @apollo/experimental-nextjs-app-support'. 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-rv8p-rr2h-fgpg",
  "modified" : "2024-01-30T20:57:45Z",
  "published" : "2024-01-30T20:57:45Z",
  "aliases" : [ "CVE-2024-23841" ],
  "summary" : "@apollo/experimental-nextjs-app-support Cross-site Scripting vulnerability",
  "details" : "### Impact\n\nThe @apollo/experimental-apollo-client-nextjs NPM package is vulnerable to a cross-site scripting vulnerability. This vulnerability arises from improper handling of untrusted input when @apollo/experimental-apollo-client-nextjs performs server-side rendering of HTML pages. To fix this vulnerability, we implemented appropriate escaping to prevent javascript injection into rendered pages.\n\n### Patches\n\nTo fix this issue, please update to version 0.7.0 or later.\n\n### Workarounds\n\nThere are no known workarounds for this issue. Please update to version 0.7.0\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apollo/experimental-nextjs-app-support"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.6.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-client-nextjs/security/advisories/GHSA-rv8p-rr2h-fgpg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-23841"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apollographql/apollo-client-nextjs/commit/b92bc42abd5f8e17d4db361c36bd08e4f541a46b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apollographql/apollo-client-nextjs"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-80" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-30T20:57:45Z",
    "nvd_published_at" : "2024-01-30T18:15:48Z"
  }
}