CVE-2026-27959Koajs Koa
High 7.5 No auth needed
Follow: this CVE · Koajs · Koajs Koa We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- —
- Auth required
- No
- Published
- Feb 26, 2026
- Updated
- Jul 15, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-20
- SSVC (CISA)
- Exploitation: proof of concept · Automatable: yes · Technical impact: partial
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
What happens
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.
What to do
- Apply the vendor's security update for Koa.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| npm | koa |
≥ 3.0.0 < 3.1.2 |
3.1.2 |
npm install koa@3.1.2 |
| npm | koa |
< 2.16.4 |
2.16.4 |
npm install koa@2.16.4 |
Per OSV / GitHub Advisories (GHSA-7gcc-r8m5-44qm). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| koajs | koa | < 2.16.4 |
| koajs | koa | ≥ 3.0.0 < 3.1.2 |
Official sources
References
Links published by the sources. Open them with care.
- github.com Patch
- github.com Patch
- github.com Exploit Vendor Advisory
- access.redhat.com
- access.redhat.com
- access.redhat.com
- bugzilla.redhat.com
- security.access.redhat.com