# CVE-2025-25200: Koa has Inefficient Regular Expression Complexity

> Attackers can cause denial of service in Koa applications by sending malicious HTTP headers that trigger inefficient regular expression processing.

- **Severity:** Critical 9.2 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Feb 2025
- **Updated:** 12 Feb 2025
- **Also known as:** GHSA-593f-38f6-jp5m, ROOT-APP-NPM-CVE-2025-25200

## What is CVE-2025-25200?

CVE-2025-25200 is a critical denial of service vulnerability in koajs koa, published on 12 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Koa is expressive middleware for Node.js using ES2017 async functions. Prior to versions 0.21.2, 1.7.1, 2.15.4, and 3.0.0-alpha.3, Koa uses an evil regex to parse the `X-Forwarded-Proto` and `X-Forwarded-Host` HTTP headers. This can be exploited to carry out a Denial-of-Service attack. Versions 0.21.2, 1.7.1, 2.15.4, and 3.0.0-alpha.3 fix the issue.

Weakness: CWE-1333 (Inefficient Regular Expression Complexity)

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

8 open source packages ship an affected version, including koa. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `koa` | npm | All versions | 0.21.2 |
| `koa` | npm | All versions | 0.21.2 |
| `koa` | npm | From 1.0.0 | 1.7.1 |
| `koa` | npm | From 1.0.0 | 1.7.1 |
| `koa` | npm | From 2.0.0 | 2.15.4 |
| `koa` | npm | From 2.0.0 | 2.15.4 |
| `koa` | npm | From 3.0.0-alpha.0 | 3.0.0-alpha.3 |
| `koa` | npm | From 3.0.0-alpha.0 | 3.0.0-alpha.3 |

Products: Koajs Koa.

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

Upgrade koa to a fixed version for your release line: 0.21.2, 1.7.1, 2.15.4 or 3.0.0-alpha.3.

## Is CVE-2025-25200 being exploited?

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

Public exploit code:

- ReDoS explorando backtracking em regex, resultando em consumo excessivo de CPU e negação de serviço (DoS) em aplicações Node.js. (github_poc): https://github.com/dwictor0/PoC-CVE-2025-25200
- Patch: SQL injection in pg_dump (PostgreSQL) (github_poc): https://github.com/gduma-phData/patch-CVE-2025-25200

## Other vulnerabilities in koajs koa

- [CVE-2026-27959](https://insights.sbomify.com/CVE-2026-27959/): Koa has Host Header Injection via `ctx.hostname` (high 7.5)
- [CVE-2025-8129](https://insights.sbomify.com/CVE-2025-8129/): KoaJS Koa HTTP Header response.js back redirect (medium 5.1)
- [CVE-2025-32379](https://insights.sbomify.com/CVE-2025-32379/): XSS at ctx.redirect() function in Koajs (medium 5.0)
- [CVE-2025-62595](https://insights.sbomify.com/CVE-2025-62595/): Koa Vulnerable to Open Redirect via Trailing Double-Slash (//) in back Redirect Logic (medium 4.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2025-25200 is a critical denial of service vulnerability in koajs koa, published on 12 Feb 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-25200 in the wild and no public exploit code.

Affected packages and fixed versions:
- koa (npm): affected all versions; fixed in 0.21.2
- koa (npm): affected all versions; fixed in 0.21.2
- koa (npm): affected from 1.0.0; fixed in 1.7.1
- koa (npm): affected from 1.0.0; fixed in 1.7.1
- koa (npm): affected from 2.0.0; fixed in 2.15.4
- koa (npm): affected from 2.0.0; fixed in 2.15.4
- koa (npm): affected from 3.0.0-alpha.0; fixed in 3.0.0-alpha.3
- koa (npm): affected from 3.0.0-alpha.0; fixed in 3.0.0-alpha.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-25200/ (Markdown: https://insights.sbomify.com/CVE-2025-25200/index.md)
```

## Sources

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

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