Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. koa
  4. ›
  5. CVE-2026-27959

CVE-2026-27959: Koa has Host Header Injection via ctx.hostname

February 26, 2026

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 (e.g., evil.com:fake@legitimate.com) 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.

References

  • github.com/advisories/GHSA-7gcc-r8m5-44qm
  • github.com/koajs/koa
  • github.com/koajs/koa/commit/55ab9bab044ead4e82c70a30a4f9dc0fc9c1b6df
  • github.com/koajs/koa/commit/b76ddc01fdb703e51652b0fd131d16394cadcfeb
  • github.com/koajs/koa/security/advisories/GHSA-7gcc-r8m5-44qm
  • nvd.nist.gov/vuln/detail/CVE-2026-27959

Code Behaviors & Features

Detect and mitigate CVE-2026-27959 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.16.4, all versions starting from 3.0.0 before 3.1.2

Fixed versions

  • 3.1.2
  • 2.16.4

Solution

Upgrade to versions 2.16.4, 3.1.2 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-20: Improper Input Validation
  • CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Source file

npm/koa/CVE-2026-27959.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 24 Mar 2026 12:18:44 +0000.