Vulnerabilities in pkg:npm/@tanstack/react-query-next-experimental

PACKAGE
Advisory Identifier: GHSA-997g-27x8-43rf
Advisory Summary

CVE-2024-24558 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @tanstack/react query next experimental libraries in the npm ecosystem. The issue involves react-query-streamed-hydration cross-site scripting vulnerability. Remediation is available by upgrading affected packages to version 5.18.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@tanstack/react-query-next-experimental

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@tanstack/react-query-next-experimental. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-997g-27x8-43rf CVE-2024-24558 HIGH react-query-streamed-hydration Cross-site Scripting vulnerability

CVE-2024-24558 at a Glance

CVE Identifier CVE-2024-24558
GHSA Identifier GHSA-997g-27x8-43rf
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @tanstack/react query next experimental
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-24558

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

@tanstack/react-query-next-experimental fixed: 5.18.0
npm install @tanstack/react-query-next-experimental@5.18.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 @tanstack/react-query-next-experimental

How to Check if You Are Affected

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

npm ls @tanstack/react-query-next-experimental

Analyze the terminal output to locate any version of @tanstack/react query next experimental in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.18.0), your application is affected.

Note: The npm ls @tanstack/react-query-next-experimental 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 @tanstack/react query next experimental, 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 `@tanstack/react-query-next-experimental` NPM package is vulnerable to a cross-site scripting vulnerability. To exploit this, an attacker would need to either inject malicious input or arrange to have malicious input be returned from an endpoint. This vulnerability arises from improper handling of untrusted input when `@tanstack/react-query-next-experimental` 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 5.18.0 or later. ### Workarounds There are no known workarounds for this issue. Please update to version 5.18.0 or later.

CVE-2024-24558 Affected @tanstack/react query next experimental Versions

1 component(s)
Fixed Versions:
5.18.0
Product / Package Ecosystem Affected Versions Fixed Version
@tanstack/react-query-next-experimental
npm
≥ 5.0.0
< 5.18.0
5.18.0

References

Frequently Asked Questions

What is CVE-2024-24558?
CVE-2024-24558 is a security vulnerability in @tanstack/react query next experimental involving react-query-streamed-hydration Cross-site Scripting vulnerability under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @tanstack/react query next experimental versions are affected?
Affected versions include releases prior to 5.18.0 across affected packages: @tanstack/react-query-next-experimental.
What version fixes CVE-2024-24558?
Upgrading to 5.18.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @tanstack/react-query-next-experimental affected?
Yes, @tanstack/react-query-next-experimental is affected in releases prior to 5.18.0. Upgrade your dependency to 5.18.0 or later.
What is the CVSS score of CVE-2024-24558?
CVE-2024-24558 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-24558?
CVE-2024-24558 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-2024-24558?
Run the dependency tree command: 'npm ls @tanstack/react-query-next-experimental'. 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-997g-27x8-43rf",
  "modified" : "2024-01-30T21:34:04Z",
  "published" : "2024-01-30T20:57:22Z",
  "aliases" : [ "CVE-2024-24558" ],
  "summary" : "react-query-streamed-hydration Cross-site Scripting vulnerability",
  "details" : "### Impact\n\nThe `@tanstack/react-query-next-experimental` NPM package is vulnerable to a cross-site scripting vulnerability. To exploit this, an attacker would need to either inject malicious input or arrange to have malicious input be returned from an endpoint.\n\nThis vulnerability arises from improper handling of untrusted input when `@tanstack/react-query-next-experimental` 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 5.18.0 or later.\n\n### Workarounds\n\nThere are no known workarounds for this issue. Please update to version 5.18.0 or later.\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" : "@tanstack/react-query-next-experimental"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.18.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/TanStack/query/security/advisories/GHSA-997g-27x8-43rf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-24558"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TanStack/query/commit/f2ddaf2536e8b71d2da88a9310ac9a48c13512a1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/TanStack/query"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-30T20:57:22Z",
    "nvd_published_at" : "2024-01-30T20:15:45Z"
  }
}