Summary
React Router contains a cross-site scripting vulnerability affecting specified releases of @remix-run/react and react-router. Under conditions where attacker-controlled data is rendered without adequate contextual escaping, an attacker may execute script in a user's browser and act within that application's security context.
Affected context
The vulnerability occurs in React Router-based applications using affected package releases when untrusted or attacker-controlled values can reach a vulnerable rendering path. Risk depends on how application routes, loaders, navigation state, and rendered content handle external input, as well as the privileges available to users who view the affected content.
Exploit preconditions
- Attack surface: A web application using an affected @remix-run/react or react-router release
- Required access: Ability to cause attacker-controlled data or navigation state to be processed by the application; this may be indirect in publicly accessible applications
- Trigger point: Rendering or handling of affected route-related content in a user's browser
- Why exploitation is possible: Input reaches a browser-rendered context without sufficient contextual escaping or sanitization
Why this happens
The underlying bug is improper neutralization of untrusted input in a web page or browser-rendered response. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting, where application data is interpreted as executable markup or script rather than inert content.
Potential impact
- An attacker may execute JavaScript in a victim's browser session
- Session data or sensitive page content could be exposed
- Account actions could be performed with the victim's privileges
- Application content or user-facing state could be modified
- Phishing or redirection within the trusted application origin could occur
General mitigation guidance
Mitigation generally focuses on ensuring that untrusted values remain data throughout routing and rendering workflows.
Common defensive patterns include:
- Applying context-appropriate output encoding at rendering boundaries
- Using framework-safe rendering APIs instead of raw HTML insertion
- Sanitizing intentionally supported HTML with a narrowly configured sanitizer
- Reducing trust in route parameters, navigation state, loader data, and other external inputs
- Enforcing Content Security Policy as a defense-in-depth control
- Limiting session and application privileges available to rendered pages
- Maintaining dependency governance that identifies affected package ranges and evaluates supported remediation
How teams detect issues like this
Organizations commonly detect related risks through:
- Static analysis for raw HTML insertion, unsafe DOM sinks, and untrusted data reaching rendering APIs
- Code review checks for route parameters, loader data, and navigation state used in markup
- Dependency policy checks that flag affected React Router package ranges
- Dynamic testing with benign, non-destructive XSS markers across route and rendering inputs
- Content Security Policy reporting and browser telemetry for unexpected script activity
Automated code review and software composition analysis tools can help identify these patterns early.

