{"id":"CVE-2026-27959","published":"2026-02-26T01:45:45Z","modified":"2026-07-15T01:12:18Z","title":"Koa has Host Header Injection via `ctx.hostname`","vendor":"koajs","product":"koa","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0062,"percentile":0.44046,"provenance":"source"},"cwes":[{"id":"CWE-20","name":"Improper Input Validation"}],"references":[{"url":"https://github.com/koajs/koa/security/advisories/GHSA-7gcc-r8m5-44qm","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/koajs/koa/commit/55ab9bab044ead4e82c70a30a4f9dc0fc9c1b6df","tags":["x_refsource_MISC"]},{"url":"https://github.com/koajs/koa/commit/b76ddc01fdb703e51652b0fd131d16394cadcfeb","tags":["x_refsource_MISC"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-27959","tags":["vdb-entry","x_refsource_REDHAT"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2442928","tags":["issue-tracking","x_refsource_REDHAT"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-27959.json","tags":["x_sadp-csaf-vex"]},{"url":"https://access.redhat.com/errata/RHSA-2026:10184","tags":["vendor-advisory","x_refsource_REDHAT"]},{"url":"https://access.redhat.com/errata/RHSA-2026:7249","tags":["vendor-advisory","x_refsource_REDHAT"]}],"priority":{"score":14.1,"factors":[{"name":"EPSS percentile","points":8.81},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"koajs","affectedVersions":[{"vendor":"koajs","product":"koa","versions":[">= 3.0.0, < 3.1.2","< 2.16.4"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2026-02-26T19:31:17.215940Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"koa","vulnerableRanges":[">=3.0.0, <3.1.2","<2.16.4"],"patched":["3.1.2","2.16.4"],"from":["GHSA-7gcc-r8m5-44qm"],"provenance":"source"}],"summary":{"text":"Koa, the Node.js middleware framework, has a flaw in its ctx.hostname API, which parses the HTTP Host header naively by taking everything before the first colon without validating it against hostname syntax. An attacker who can send a crafted Host header containing an @ symbol over the network, with no authentication or user interaction needed, can make ctx.hostname return an attacker-chosen value, which affects applications that use it for URL generation, password reset or email verification links, or routing decisions.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:50:24Z"},"euvd":{"id":"EUVD-2026-8816","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-koajs-koa-cve-2025-25200","parents":[{"from":"CVE-2025-25200","to":"CVE-2026-27959","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/request.js"],"commits":["https://github.com/koajs/koa/commit/5054af6e31ffd451a4151a1fe144cef6e5d0d83c","https://github.com/koajs/koa/commit/5f294bb1c7c8d9c61904378d250439a321bffd32","https://github.com/koajs/koa/commit/55ab9bab044ead4e82c70a30a4f9dc0fc9c1b6df","https://github.com/koajs/koa/commit/b76ddc01fdb703e51652b0fd131d16394cadcfeb"],"basis":"rarely changed file"}]}],"packageHistory":[{"cve":"CVE-2025-32379","published":"2025-04-09","fixed":"3.0.0-alpha.5","kev":false},{"cve":"CVE-2025-8129","published":"2025-07-25","fixed":"3.0.1","kev":false},{"cve":"CVE-2025-62595","published":"2025-10-21","fixed":"3.0.3","kev":false,"link":{"from":"CVE-2025-62595","to":"CVE-2026-27959","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"npm:koa","fromFixed":"3.0.3","toFixed":"3.1.2","daysApart":128},{"kind":"version-step","provenance":"source","package":"npm:koa","fromFixed":"2.16.3","toFixed":"2.16.4","daysApart":128}]}},{"cve":"CVE-2026-27959","published":"2026-02-26","fixed":"3.1.2","kev":false}],"package":"npm:koa"}}