Packages / koa / Security

CriticalVulnerabilityGHSA-593f-38f6-jp5mCVE-2025-25200Published 12 Feb 2025

Inefficient Regular Expression Complexity in koa

Your version

Affected releases · koa

  • 2.x2.0.0 – 2.15.3Fixed in 2.15.4
  • 1.x1.0.0 – 1.7.0Fixed in 1.7.1
  • 0.21.x0.21.0 – 0.21.1Fixed in 0.21.2
  • 0.20.x and older0.0.1 – 0.20.0No fix, no longer updated

On 2.x, the newest line:

npm install koa@2.15.4
Every release on a timeline
3.x
  1. Not affected

    3.0.0 – 3.3.0

    10 releases, latest

2.x
  1. Affected

    2.0.0 – 2.15.3

    35 releases

  2. Fixed

    2.15.4 – 2.16.4

    6 releases

1.x
  1. Affected

    1.0.0 – 1.7.0

    19 releases

  2. Fixed

    1.7.1

    1 release

0.x
  1. Affected

    0.0.1 – 0.21.1

    41 releases

  2. Fixed

    0.21.2

    1 release

113 stable releases of koa, oldest to newest, one row per major.

What happens

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.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.