CVE-2025-25200: Koa Package Suffers from Regex Denial-of-Service Vulnerability

koa Updated 14 Dec 2025

Summary

12/02/2025
Yes i
Critical
9.2

CVE-2025-25200: Inefficient Regular Expression Complexity in koa. Affects koa across 4 version ranges.

< 0.21.2 >= 1.0.0, < 1.7.1 >= 2.0.0, < 2.15.4 >= 3.0.0-alpha.0, < 3.0.0-alpha.3

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Koa is a popular web framework for Node.js, designed to be lightweight and flexible. It allows developers to build web applications and APIs with a focus on middleware, making it easy to manage requests and responses. Koa's architecture promotes the use of async functions, which enhances performance and scalability. However, a recent vulnerability has been identified that affects its ability to handle certain HTTP headers securely.

Vulnerability Detail

The vulnerability arises from the use of an inefficient regular expression to parse the 'X-Forwarded-Proto' and 'X-Forwarded-Host' HTTP headers. This regex can be exploited to perform a Denial-of-Service (DoS) attack, leading to memory exhaustion. Attackers can send specially crafted requests that trigger excessive backtracking in the regex engine, causing the application to become unresponsive. This issue is classified under CWE-1333, highlighting the risks associated with poorly designed regex patterns.

How To Fix

Latest published version: 3.2.1 as of 22 Oct 2026

npm install koa@3.2.1

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 0.21.2 0.21.2
    npm install koa@0.21.2
  • >= 1.0.0, < 1.7.1 1.7.1
    npm install koa@1.7.1
  • >= 2.0.0, < 2.15.4 2.15.4
    npm install koa@2.15.4
  • >= 3.0.0-alpha.0, < 3.0.0-alpha.3 3.0.0-alpha.3
    npm install koa@3.0.0-alpha.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, you can validate and sanitize the 'X-Forwarded-Proto' and 'X-Forwarded-Host' headers before they are processed by Koa. This can be done by implementing middleware that checks for empty or malformed values and rejects requests that do not meet your criteria.

Conclusion

The Koa framework has a critical vulnerability related to regex parsing of HTTP headers, which can lead to Denial-of-Service attacks. It is crucial for developers using Koa to update to the latest patched versions to protect their applications. Implementing additional validation can serve as a temporary workaround while transitioning to secure versions.

See every vulnerability recorded for koa →

Share this vulnerability

FAQ

The vulnerability is a Regex Denial-of-Service (ReDoS) attack that can exhaust memory resources, causing the application to crash or become unresponsive.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Versions of Koa from 0.0.0 to 2.15.3, and 3.0.0-alpha.0 to 3.0.0-alpha.2 are affected by this vulnerability.

Yes, you can implement middleware to validate and sanitize the affected HTTP headers before they reach Koa.

If immediate upgrading is not possible, ensure to monitor your application closely for unusual traffic patterns and consider implementing the suggested middleware as a temporary measure.

Related vulnerabilities

Recent vulnerabilities recorded for koa.

How To Fix

Latest published version: 3.2.1 as of 22 Oct 2026

npm install koa@3.2.1

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 0.21.2 0.21.2
    npm install koa@0.21.2
  • >= 1.0.0, < 1.7.1 1.7.1
    npm install koa@1.7.1
  • >= 2.0.0, < 2.15.4 2.15.4
    npm install koa@2.15.4
  • >= 3.0.0-alpha.0, < 3.0.0-alpha.3 3.0.0-alpha.3
    npm install koa@3.0.0-alpha.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback