CVE-2025-32379: Koa Cross-Site Scripting Vulnerability
MODERATECVE-2025-32379 is a MODERATE (CVSS 5.0) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Koa libraries in the npm ecosystem. The issue involves koajs vulnerable to cross-site scripting (xss) at ctx.redirect() function. Remediation is available by upgrading affected packages to version 2.16.1, 3.0.0-alpha.5.
CVE-2025-32379 at a Glance
Security Impact
CVSS: 5.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L).
How to Fix CVE-2025-32379
To remediate this vulnerability, upgrade all affected Koa dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install koa@2.16.1
npm install koa@3.0.0-alpha.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls koa
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-32379, inspect your project dependencies using npm:
npm ls koa
Analyze the terminal output to locate any version of Koa in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.16.1), your application is affected.
Note: The npm ls koa command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Koa, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-32379 Affected Koa Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2025-32379?
Which Koa versions are affected?
What version fixes CVE-2025-32379?
Is koa affected?
What is the CVSS score of CVE-2025-32379?
What CWE is associated with CVE-2025-32379?
How can I check npm dependencies for CVE-2025-32379?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x2rg-q646-7m2v",
"modified" : "2025-04-09T20:29:43Z",
"published" : "2025-04-09T13:00:07Z",
"aliases" : [ "CVE-2025-32379" ],
"summary" : "Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function",
"details" : "### Summary\nIn 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.\n\n### Patches\nThis issue is patched in 2.16.1 and 3.0.0-alpha.5.\n\n### PoC\nComing soon...\n\n### Impact\n1. Redirect user to another phishing site\n2. Make request to another endpoint of the application based on user's cookie\n3. Steal user's cookie",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "koa"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.16.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "koa"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0-alpha.1"
}, {
"fixed" : "3.0.0-alpha.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/security/advisories/GHSA-x2rg-q646-7m2v"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-32379"
}, {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/commit/ff25eb4a7f2392df46481fe86355161067687312"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/koajs/koa"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-04-09T13:00:07Z",
"nvd_published_at" : "2025-04-09T16:15:25Z"
}
}