Packages / koa / Security

ModerateVulnerabilityGHSA-x2rg-q646-7m2vCVE-2025-32379Published 9 Apr 2025

Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function

Your version

Affected releases · koa

  • 2.x2.0.0 – 2.16.0Fixed in 2.16.1
  • 1.x and older0.0.1 – 1.7.1No fix, no longer updated

On 2.x, the newest line:

npm install koa@2.16.1
Every release on a timeline
3.x
  1. Not affected

    3.0.0 – 3.3.0

    10 releases, latest

2.x
  1. Affected

    2.0.0 – 2.16.0

    37 releases

  2. Fixed

    2.16.1 – 2.16.4

    4 releases

1.x
  1. Affected

    1.0.0 – 1.7.1

    20 releases

0.x
  1. Affected

    0.0.1 – 0.21.2

    42 releases

113 stable releases of koa, oldest to newest, one row per major.

What happens

Summary

In koa < 2.16.1 and < 3.0.0-alpha.5, passing untrusted user input to ctx.redirect() even after sanitizing it, may execute javascript code on the user who use the app.

Patches

This issue is patched in 2.16.1 and 3.0.0-alpha.5.

PoC

Coming soon...

Impact

  1. Redirect user to another phishing site

  2. Make request to another endpoint of the application based on user's cookie

  3. Steal user's cookie

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.