Skip to main content
← All vulnerabilities
CVE-2026-27959GHSA-7GCC-R8M5-44QM

Koa has Host Header Injection via `ctx.hostname`

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 3.1.2, 2.16.4
1 proof of concept on GitHub
  • Exploitation: poc
  • Automatable: yes
  • Technical impact: partial

Summary

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.

Timeline

  1. CVE published
  2. CISA SSVC assessment

    Exploitation: poc · Automatable: yes · Technical impact: partial

  3. Record last updated

Affected versions

  • koajs koa

    From 3.0.0 · fixed in 3.1.2; fixed in 2.16.4

  • koanpm

    From 3.0.0 · fixed in 3.1.2

  • koanpm

    fixed in 2.16.4

References 4

GitHub · koajs/koa

GitHub · mlouazir/CVE-2026-27959-mini-lab