9.2critical
Koa has Inefficient Regular Expression Complexity
- Severity
- 9.2critical CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.88% (higher than 60% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-593f-38f6-jp5m
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| koajs koa | < 0.21.2, >= 1.0.0, < 1.7.1, >= 2.0.0-alpha.1, < 2.15.4, >= 3.0.0-alpha.0, < < 3.0.0-alpha.3, before 0.21.2, from 1.0.0 before 1.7.1, from 2.0.0 before 2.15.4, 3.0.0 | CVE List, NVD |
| koa (npm) | from 2.0.0 before 2.15.4, from 3.0.0-alpha.0 before 3.0.0-alpha.3, from 1.0.0 before 1.7.1, before 0.21.2 | GitHub Advisory Database |
All scores
| GitHub_M | 9.2critical CVSS:4.0 | 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 |
| GitHub | critical CVSS:4.0 | 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 |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
Summary
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.
PoC
Coming soon.
Impact
This is a Regex Denial-of-Service attack and causes memory exhaustion. The regex should be improved and empty values should not be allowed.
NVD (es)
Koa es un middleware expresivo para Node.js que utiliza funciones asincrónicas ES2017. En versiones anteriores a las 0.21.2, 1.7.1, 2.15.4 y 3.0.0-alpha.3, Koa utiliza una expresión regular maliciosa para analizar los encabezados HTTP `X-Forwarded-Proto` y `X-Forwarded-Host`. Esto se puede aprovechar para llevar a cabo un ataque de denegación de servicio. Las versiones 0.21.2, 1.7.1, 2.15.4 y 3.0.0-alpha.3 solucionan el problema.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-25200 changed 2025-02-12 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-593f-38f6-jp5m changed 2025-02-12 | CC-BY-4.0 |
| NVD | CVE-2025-25200 changed 2026-06-17 | Public domain |