MediumGHSA-x2rg-q646-7m2vCVE-2025-32379
Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function
Published 9 Apr 2025 · Updated 9 Apr 2025
Affected packages
koanpm
- Affected
- <2.16.1
- Fixed in
- 2.16.1
Update to the fixed version for your release line, for example:
npm install koa@2.16.1koanpm
- Affected
- >=3.0.0-alpha.1 <3.0.0-alpha.5
- Fixed in
- 3.0.0-alpha.5
Update to the fixed version for your release line, for example:
npm install koa@3.0.0-alpha.5Details
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
Is GHSA-x2rg-q646-7m2v in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected koa, and gives you the command that fixes it.
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.