CVE-2026-27959 Details
Description
Koa is middleware for Node.js using ES2017 async functions. Prior to versions 3.1.2 and 2.16.4, Koa's `ctx.hostname` API performs naive parsing of the HTTP Host header, extracting everything before the first colon without validating the input conforms to RFC 3986 hostname syntax. When a malformed Host header containing a `@` symbol is received, `ctx.hostname` returns `evil[.]com` - an attacker-controlled value. Applications using `ctx.hostname` for URL generation, password reset links, email verification URLs, or routing decisions are vulnerable to Host header injection attacks. Versions 3.1.2 and 2.16.4 fix the issue.
A host header injection vulnerability has been identified in Koa versions 3.0.0 through 3.1.1 and 2.16.3 prior to 2.16.4. The issue arises because the `ctx.hostname` API naively parses the HTTP Host header, extracting everything before the first colon without validating the input against RFC 3986 hostname syntax. This flaw allows an attacker to inject a malformed Host header containing a `@` symbol, which `ctx.hostname` incorrectly processes as a valid hostname, returning an attacker-controlled value. This vulnerability can be exploited in applications that use `ctx.hostname` for URL generation, password reset links, email verification URLs, or routing decisions.
Users can upgrade to Koa versions 3.1.2 or 2.16.4 to address this vulnerability.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Feb 26, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-20 | Improper Input Validation | redhat-SADP |
| CWE-20 | Improper Input Validation | [email protected] |
| NVD-CWE-noinfo | Insufficient Information to Classify Weakness | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| koajs koa | < 2.16.4 >= 3.0.0, < 3.1.2 |
CPE
Remediation
| |
Change History
7 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jul 15, 2026 | CVE Modified | redhat-SADP |
| Jun 30, 2026 | CVE Modified | redhat-SADP |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 16, 2026 | Reanalysis | [email protected] |
| Feb 28, 2026 | Initial Analysis | [email protected] |
| Feb 26, 2026 | New CVE Received | [email protected] |