/

CVE-2026-102989

Severity:

CRITICAL RISK

(9.3)

Reflected XSS (CWE-79) in TanStack Start Server Functions

CVE-2026-102989

Awaiting Analysis

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Same-Origin Script Execution and Account Impersonation

Severity:

CRITICAL RISK

(9.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical cross-site scripting vulnerability in TanStack Start server functions can allow an unauthenticated attacker to make a crafted server-function URL return attacker-controlled HTML from the application's origin. If a visitor opens that URL, injected script may access same-origin data and send requests using the visitor's authority.

A critical cross-site scripting vulnerability in TanStack Start server functions can allow an unauthenticated attacker to make a crafted server-function URL return attacker-controlled HTML from the application's origin. If a visitor opens that URL, injected script may access same-origin data and send requests using the visitor's authority.

Affected context

The issue may occur in TanStack Start applications using affected server-function components when specially crafted request payload fields influence middleware state and the error-handling path. It becomes especially risky when the resulting response is interpreted as HTML by a browser and users can be persuaded to open attacker-controlled URLs.

The issue may occur in TanStack Start applications using affected server-function components when specially crafted request payload fields influence middleware state and the error-handling path. It becomes especially risky when the resulting response is interpreted as HTML by a browser and users can be persuaded to open attacker-controlled URLs.

Exploit preconditions

  • Attack surface: Public server-function endpoints and their generated URLs
  • Required access: No authentication is required to submit the crafted request
  • Trigger point: A server-function request reaches middleware and error handling with attacker-controlled non-public fields
  • Victim interaction: A visitor must open the resulting URL in a browser
  • Why exploitation is possible: A response-shaped object can be accepted as an HTTP response, allowing attacker-controlled HTML to be served from the application's origin
  • Attack surface: Public server-function endpoints and their generated URLs
  • Required access: No authentication is required to submit the crafted request
  • Trigger point: A server-function request reaches middleware and error handling with attacker-controlled non-public fields
  • Victim interaction: A visitor must open the resulting URL in a browser
  • Why exploitation is possible: A response-shaped object can be accepted as an HTTP response, allowing attacker-controlled HTML to be served from the application's origin

Why this happens

The vulnerability results from insufficient separation between internal server-function state and externally supplied request data. Attacker-controlled fields can influence middleware and error-path processing, where an object with response-like properties is treated as a valid HTTP response without adequate output or type validation.

This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted data can reach an HTML response context and become executable browser content.

The vulnerability results from insufficient separation between internal server-function state and externally supplied request data. Attacker-controlled fields can influence middleware and error-path processing, where an object with response-like properties is treated as a valid HTTP response without adequate output or type validation.

This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted data can reach an HTML response context and become executable browser content.

Potential impact

  • An attacker may execute JavaScript in a visitor's origin context
  • Injected script could read accessible same-origin data
  • An attacker could issue requests using the visitor's authenticated authority
  • User sessions, application data, or administrative actions could be exposed
  • The vulnerability could enable phishing, data modification, or account compromise
  • An attacker may execute JavaScript in a visitor's origin context
  • Injected script could read accessible same-origin data
  • An attacker could issue requests using the visitor's authenticated authority
  • User sessions, application data, or administrative actions could be exposed
  • The vulnerability could enable phishing, data modification, or account compromise

General mitigation guidance

Mitigation generally focuses on preventing untrusted request data from controlling response construction or HTML content.

Common defensive patterns include:

  • Treating server-function request fields as untrusted and excluding internal state from client-controlled input
  • Enforcing strict schemas and allowlists for request payloads and middleware state
  • Separating error objects from HTTP response objects using explicit types and controlled response factories
  • Returning non-HTML, safely encoded error responses by default
  • Applying contextual output encoding and restrictive content security policies
  • Limiting server-function privileges and requiring authorization for sensitive operations
  • Testing malformed requests and error paths as part of security-focused application testing

Mitigation generally focuses on preventing untrusted request data from controlling response construction or HTML content.

Common defensive patterns include:

  • Treating server-function request fields as untrusted and excluding internal state from client-controlled input
  • Enforcing strict schemas and allowlists for request payloads and middleware state
  • Separating error objects from HTTP response objects using explicit types and controlled response factories
  • Returning non-HTML, safely encoded error responses by default
  • Applying contextual output encoding and restrictive content security policies
  • Limiting server-function privileges and requiring authorization for sensitive operations
  • Testing malformed requests and error paths as part of security-focused application testing

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying implicit conversion of user-controlled objects into HTTP responses
  • Code review checks for client-controlled fields reaching middleware state or error handlers
  • Tests that submit unexpected fields and verify that responses cannot change content type or body unexpectedly
  • Dynamic testing of public server-function URLs for reflected HTML and script execution
  • Content Security Policy reporting and web application monitoring for unusual inline script or response behavior
  • CI policy checks requiring schema validation and explicit response construction on server boundaries

Organizations can look for this class of issue through:

  • Static analysis rules identifying implicit conversion of user-controlled objects into HTTP responses
  • Code review checks for client-controlled fields reaching middleware state or error handlers
  • Tests that submit unexpected fields and verify that responses cannot change content type or body unexpectedly
  • Dynamic testing of public server-function URLs for reflected HTML and script execution
  • Content Security Policy reporting and web application monitoring for unusual inline script or response behavior
  • CI policy checks requiring schema validation and explicit response construction on server boundaries

Sources

SourceLink
github.comgithub.com/TanStack/router/commit/d521abd71c69f1ff010bb3def4d417cb5fa058cb
github.comgithub.com/TanStack/router/pull/8573
github.comgithub.com/TanStack/router/releases/tag/release-2026-09-30-1747
github.comgithub.com/TanStack/router/security/advisories/GHSA-qx66-fv34-fjm8

Frequently asked

questions

Yes. The described attack does not require authentication to submit a crafted server-function request, although a visitor generally must open the resulting URL for browser-side script execution to occur.

The attacker needs network access to a publicly reachable affected server-function endpoint. They do not generally need application credentials.

Ensure that untrusted request fields cannot control middleware state or response construction. Use strict schemas, explicit response types, safe error handling, and appropriate output encoding.

Treat all server-function input as untrusted, test error and middleware paths with malformed data, enforce authorization for sensitive actions, and use security headers such as a restrictive Content Security Policy.

Yes. The described attack does not require authentication to submit a crafted server-function request, although a visitor generally must open the resulting URL for browser-side script execution to occur.

The attacker needs network access to a publicly reachable affected server-function endpoint. They do not generally need application credentials.

Ensure that untrusted request fields cannot control middleware state or response construction. Use strict schemas, explicit response types, safe error handling, and appropriate output encoding.

Treat all server-function input as untrusted, test error and middleware paths with malformed data, enforce authorization for sensitive actions, and use security headers such as a restrictive Content Security Policy.

Find out what's already
exploitable in your codebase.