# CVE-2025-31137: Remix and React Router allow URL manipulation via Host / X-Forwarded-Host headers

> Attackers can spoof request URLs via Host headers in Remix/React Router apps, potentially bypassing security controls or causing redirects.

- **Severity:** High 7.5 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Apr 2025
- **Updated:** 2 Apr 2025
- **Also known as:** GHSA-4q56-crqp-v477

## What is CVE-2025-31137?

CVE-2025-31137 is a high-severity vulnerability in remix-run react-router, published on 1 Apr 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

React Router is a multi-strategy router for React bridging the gap from React 18 to React 19. There is a vulnerability in Remix/React Router that affects all Remix 2 and React Router 7 consumers using the Express adapter. Basically, this vulnerability allows anyone to spoof the URL used in an incoming Request by putting a URL pathname in the port section of a URL that is part of a Host or X-Forwarded-Host header sent to a Remix/React Router request handler. This issue has been patched and released in Remix 2.16.3 and React Router 7.4.1.

Weakness: CWE-444 (Inconsistent Interpretation of HTTP Requests)

## Which versions are affected by CVE-2025-31137?

4 open source packages ship an affected version, including @react-router/express and @remix-run/express.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@react-router/express` | npm | From 7.0.0 | 7.4.1 |
| `@react-router/express` | npm | From 7.0.0 | 7.4.1 |
| `@remix-run/express` | npm | From 2.11.1 | 2.16.3 |
| `@remix-run/express` | npm | From 2.11.1 | 2.16.3 |

## How do I fix CVE-2025-31137?

Upgrade @react-router/express to 7.4.1 or later.

## Is CVE-2025-31137 being exploited?

There is no known exploitation of CVE-2025-31137 in the wild and no public exploit code.

Public exploit code:

- https://github.com/pouriam23/vulnerability-in-Remix-React-Router-CVE-2025-31137- (github_poc): https://github.com/pouriam23/vulnerability-in-Remix-React-Router-CVE-2025-31137-

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-31137 and fix it if it is affected.

What it is: CVE-2025-31137 is a high-severity vulnerability in remix-run react-router, published on 1 Apr 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-31137 in the wild and no public exploit code.

Affected packages and fixed versions:
- @react-router/express (npm): affected from 7.0.0; fixed in 7.4.1
- @react-router/express (npm): affected from 7.0.0; fixed in 7.4.1
- @remix-run/express (npm): affected from 2.11.1; fixed in 2.16.3
- @remix-run/express (npm): affected from 2.11.1; fixed in 2.16.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-31137/ (Markdown: https://insights.sbomify.com/CVE-2025-31137/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-31137
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-31137
- OSV: https://osv.dev/vulnerability/CVE-2025-31137

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-31137/
Summaries are generated and may contain mistakes; the official description above is the record.
