CVE-2025-25200: Koa Inefficient Regular Expression Complexity Vulnerability

CRITICAL
Advisory Identifier: GHSA-593f-38f6-jp5m
CWE-1333
Published
Advisory Summary

CVE-2025-25200 is a CRITICAL inefficient regular expression complexity vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Koa libraries in the npm ecosystem. The issue involves inefficient regular expression complexity in koa. Remediation is available by upgrading affected packages to version 2.15.4, 3.0.0-alpha.3, 1.7.1, 0.21.2.

CVE-2025-25200 at a Glance

CVE Identifier CVE-2025-25200
GHSA Identifier GHSA-593f-38f6-jp5m
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Koa
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-25200

To remediate this vulnerability, upgrade all affected Koa dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

koa fixed: 2.15.4
npm install koa@2.15.4
koa fixed: 3.0.0-alpha.3
npm install koa@3.0.0-alpha.3
koa fixed: 1.7.1
npm install koa@1.7.1
koa fixed: 0.21.2
npm install koa@0.21.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls koa

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-25200, inspect your project dependencies using npm:

npm ls koa

Analyze the terminal output to locate any version of Koa in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.15.4), your application is affected.

Note: The npm ls koa command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Koa, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2025-25200 Affected Koa Versions

4 component(s)
Fixed Versions:
2.15.43.0.0-alpha.31.7.10.21.2
Product / Package Ecosystem Affected Versions Fixed Version
koa
npm
≥ 2.0.0
< 2.15.4
2.15.4
koa
npm
≥ 3.0.0-alpha.0
< 3.0.0-alpha.3
3.0.0-alpha.3
koa
npm
≥ 1.0.0
< 1.7.1
1.7.1
koa
npm
< 0.21.2
0.21.2

References

Frequently Asked Questions

What is CVE-2025-25200?
CVE-2025-25200 is a security vulnerability in Koa involving Inefficient Regular Expression Complexity in koa under CWE-1333: Inefficient Regular Expression Complexity.
Which Koa versions are affected?
Affected versions include releases prior to 2.15.4, 3.0.0-alpha.3, 1.7.1, 0.21.2 across affected packages: koa.
What version fixes CVE-2025-25200?
Upgrading to 2.15.4, 3.0.0-alpha.3, 1.7.1, 0.21.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is koa affected?
Yes, koa is affected in releases prior to 2.15.4, 3.0.0-alpha.3, 1.7.1, 0.21.2. Upgrade your dependency to 2.15.4, 3.0.0-alpha.3, 1.7.1, 0.21.2 or later.
What CWE is associated with CVE-2025-25200?
CVE-2025-25200 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2025-25200?
Run the dependency tree command: 'npm ls koa'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-593f-38f6-jp5m",
  "modified" : "2025-02-12T19:23:09Z",
  "published" : "2025-02-12T19:23:09Z",
  "aliases" : [ "CVE-2025-25200" ],
  "summary" : "Inefficient Regular Expression Complexity in koa",
  "details" : "### Summary\nKoa 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.\n\n### PoC\n\nComing soon.\n\n### Impact\nThis is a Regex Denial-of-Service attack and causes memory exhaustion. The regex should be improved and empty values should not be allowed.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "koa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.15.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "koa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0-alpha.0"
      }, {
        "fixed" : "3.0.0-alpha.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "koa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.7.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "koa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.21.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/koajs/koa/security/advisories/GHSA-593f-38f6-jp5m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-25200"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/koajs/koa/commit/5054af6e31ffd451a4151a1fe144cef6e5d0d83c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/koajs/koa/commit/5f294bb1c7c8d9c61904378d250439a321bffd32"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/koajs/koa/commit/93fe903fc966635a991bcf890cfc3427d33a1a08"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/koajs/koa"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/koajs/koa/releases/tag/2.15.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-12T19:23:09Z",
    "nvd_published_at" : "2025-02-12T18:15:28Z"
  }
}