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.
The product uses a regular expression with an inefficient, possibly exponential worst-case computational complexity that consumes excessive CPU cycles.
| Name | Vendor | Start Version | End Version |
|---|---|---|---|
| Koa | Koajs | * | 0.21.2 (excluding) |
| Koa | Koajs | 1.0.0 (including) | 1.7.1 (excluding) |
| Koa | Koajs | 2.0.0 (including) | 2.15.4 (excluding) |
| Koa | Koajs | 3.0.0-alpha0 (including) | 3.0.0-alpha0 (including) |
| Koa | Koajs | 3.0.0-alpha1 (including) | 3.0.0-alpha1 (including) |
| Koa | Koajs | 3.0.0-alpha2 (including) | 3.0.0-alpha2 (including) |
Attackers can create crafted inputs that
intentionally cause the regular expression to use
excessive backtracking in a way that causes the CPU
consumption to spike.