CVE-2025-8129: Koa Koa Open Redirect Vulnerability
LOWCVE-2025-8129 is a LOW (CVSS 3.5) koa open redirect vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Koa libraries in the npm ecosystem. The issue involves koa open redirect via referrer header (user-controlled). Remediation is available by upgrading affected packages to version 2.16.2, 3.0.1.
CVE-2025-8129 at a Glance
Security Impact
CVSS: 3.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N).
How to Fix CVE-2025-8129
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.2
npm install koa@3.0.1
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-8129, 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.2), 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-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. 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-8129 Affected Koa Versions
2 component(s)References
Frequently Asked Questions
What is CVE-2025-8129?
Which Koa versions are affected?
What version fixes CVE-2025-8129?
Is koa affected?
What is the CVSS score of CVE-2025-8129?
What CWE is associated with CVE-2025-8129?
How can I check npm dependencies for CVE-2025-8129?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jgmv-j7ww-jx2x",
"modified" : "2025-07-30T14:14:46Z",
"published" : "2025-07-29T19:11:25Z",
"aliases" : [ "CVE-2025-8129" ],
"summary" : "Koa Open Redirect via Referrer Header (User-Controlled)",
"details" : "## Summary\nIn the latest version of Koa, the back method used for redirect operations adopts an insecure implementation, which uses the user-controllable referrer header as the redirect target.\n\n## Details\non the API document https://www.koajs.net/api/response#responseredirecturl-alt, we can see:\n\n**response.redirect(url, [alt])**\n```\nPerforms a [302] redirect to url.\nThe string \"back\" is specially provided for Referrer support, using alt or \"/\" when Referrer does not exist.\n\nctx.redirect('back');\nctx.redirect('back', '/index.html');\nctx.redirect('/login');\nctx.redirect('http://google.com');\n\n```\nhowever, the \"back\" method is insecure:\n\n- https://github.com/koajs/koa/blob/master/lib/response.js#L322\n```\n back (alt) {\n const url = this.ctx.get('Referrer') || alt || '/'\n this.redirect(url)\n },\n```\nReferrer Header is User-Controlled.\n\n\n## PoC\n\n**there is a demo for POC:**\n```\nconst Koa = require('koa')\nconst serve = require('koa-static')\nconst Router = require('@koa/router')\nconst path = require('path')\n\nconst app = new Koa()\nconst router = new Router()\n\n// Serve static files from the public directory\napp.use(serve(path.join(__dirname, 'public')))\n\n// Define routes\nrouter.get('/test', ctx => {\n ctx.redirect('back', '/index1.html')\n})\n\nrouter.get('/test2', ctx => {\n ctx.redirect('back')\n})\n\nrouter.get('/', ctx => {\n ctx.body = 'Welcome to the home page! Try accessing /test, /test2'\n})\n\napp.use(router.routes())\napp.use(router.allowedMethods())\n\nconst port = 3000\napp.listen(port, () => {\n console.log(`Server running at http://localhost:${port}`)\n}) \n```\n**Proof Of Concept**\n```\nGET /test HTTP/1.1\nHost: 127.0.0.1:3000\nReferer: http://www.baidu.com\nConnection: close\n\n\nGET /test2 HTTP/1.1\nHost: 127.0.0.1:3000\nReferer: http://www.baidu.com\nConnection: close\n```\n\n\n\n\n\n## Impact\nhttps://learn.snyk.io/lesson/open-redirect/",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "koa"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.16.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "koa"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0-alpha.0"
}, {
"fixed" : "3.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/security/advisories/GHSA-jgmv-j7ww-jx2x"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54420"
}, {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/issues/1892"
}, {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/issues/1892#issue-3213028583"
}, {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/commit/422c551c63d00f24e2bbbdf492f262a5935bb1f0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/koajs/koa"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?ctiid.317514"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?id.317514"
}, {
"type" : "WEB",
"url" : "https://vuldb.com/?submit.619741"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-601" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-29T19:11:25Z",
"nvd_published_at" : "2025-07-29T17:15:33Z"
}
}