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 vulnerability concerns parsing HTTP headers `X-Forwarded-Proto` and `X-Forwarded-Host` using an 'evil regex' — a regular expression vulnerable to catastrophic backtracking. An attacker can send a specially crafted HTTP request containing an appropriately constructed value of these headers. Processing such a request causes exponential lengthening of the execution time of the regular expression, leading to blocking of the Node.js thread and unavailability of the application.
An unauthenticated attacker can cause a denial of service (DoS) both in the context of the application itself and the system on which it runs, effectively preventing the handling of legitimate requests.
Koa should be updated to version 0.21.2, 1.7.1, 2.15.4, or 3.0.0-alpha.3 (depending on the branch used), in which the issue has been fixed. Additionally, consider filtering or validating `X-Forwarded-Proto` and `X-Forwarded-Host` headers at the reverse proxy or firewall level before passing them to the application.
Koa (koajs/koa) in versions prior to 0.21.2, 1.7.1, 2.15.4, and 3.0.0-alpha.3
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XKoajs Koa
APPKoajs3.0.0< 0.21.21.0.0 – 1.7.1 (excl.)2.0.0 – 2.15.4 (excl.)
Related vulnerabilities
Koa is middleware for Node.js using ES2017 async functions. Prior to versions 3.1.2 and 2.16.4, Koa's `ctx.hos...
Koa is expressive middleware for Node.js using ES2017 async functions. In versions 2.16.2 to before 2.16.3 and...
Koa is expressive middleware for Node.js using ES2017 async functions. In koa < 2.16.1 and < 3.0.0-alpha.5, pa...
Podatliwość w KoaJS Koa do wersji 3.0.0 została klasyfikowana jako problematyczna. Dotyczy funkcji back w plik...
@koa/cors npm provides Cross-Origin Resource Sharing (CORS) for koa, a web framework for Node.js. Prior to ver...