Inefficient Regular Expression Complexity in koa

Description

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.

Basic information

Type
reviewed
Severity
critical
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2025-02-12 19:23:09 UTC
Updated
2025-02-12 19:23:12 UTC
GitHub reviewed
2025-02-12 19:23:09 UTC
NVD published
2025-02-12 18:15:28 UTC

EPSS Score

Score Percentile
0.36% 57.64%

CVSS Scores

Base score Version Severity Vector
9.2 4.0
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 Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network.
Attack complexity (AC:L)
Exploitation conditions are straightforward and stable.
Attack requirements (AT:N)
No additional preconditions are required beyond normal reachability.
Privileges required (PR:N)
No privileges are required.
User interaction (UI:N)
No user interaction is required.
Vulnerable system confidentiality impact (VC:N)
No confidentiality impact on the vulnerable system.
Vulnerable system integrity impact (VI:N)
No integrity impact on the vulnerable system.
Vulnerable system availability impact (VA:H)
High availability impact on the vulnerable system.
Subsequent system confidentiality impact (SC:N)
No confidentiality impact on subsequent systems.
Subsequent system integrity impact (SI:N)
No integrity impact on subsequent systems.
Subsequent system availability impact (SA:H)
High availability impact on subsequent systems.

Identifiers

CWEs

CWE id Name
CWE-1333 Inefficient Regular Expression Complexity

Credits

  • R4356th (reporter)

Affected packages (4)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
npm koa >= 2.0.0, < 2.15.4 2.15.4
npm koa >= 3.0.0-alpha.0, < 3.0.0-alpha.3 3.0.0-alpha.3
npm koa >= 1.0.0, < 1.7.1 1.7.1
npm koa < 0.21.2 0.21.2

References

cvelogic Threat Intelligence