{"id":"CVE-2026-39408","aliases":["GHSA-xf4j-xp2r-rqqx"],"url":"https://o3.security/vulnerability/CVE-2026-39408","summary":"Hono has a path traversal in toSSG() allows writing files outside the output directory","details":"## Summary\n\nA path traversal issue in `toSSG()` allows files to be written outside the configured output directory during static site generation. When using dynamic route parameters via `ssgParams`, specially crafted values can cause generated file paths to escape the intended output directory.\n\n## Details\n\nThe static site generation process creates output files based on route paths derived from application routes and parameters. When `ssgParams` is used to provide values for dynamic routes, those values are used to construct output file paths. If these values contain traversal sequences (e.g. `..`), the resulting output path may resolve outside the configured output directory. As a result, files may be written to unintended locations instead of being confined within the specified output directory.\n\nFor example:\n \n```ts\nimport { Hono } from 'hono'\nimport { toSSG, ssgParams } from 'hono/ssg'\n\nconst app = new Hono()\n\napp.get('/:id', ssgParams([{ id: '../pwned' }]), (c) => {\n  return c.text('pwned')\n})\n\ntoSSG(app, fs, { dir: './static' })\n```\n\nIn this case, the generated output path may resolve outside `./static`, resulting in a file being written outside the intended output directory.\n\n## Impact\n\nAn attacker who can influence values passed to `ssgParams` during the build process may be able to write files outside the intended output directory.\n\nDepending on the build and deployment environment, this may:\n\n* overwrite unintended files\n* affect generated artifacts\n* impact deployment outputs or downstream tooling\n\nThis issue is limited to build-time static site generation and does not affect request-time routing.","published":"2026-04-08T14:42:25.357Z","modified":"2026-08-12T03:51:16.575876900Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"hono","fixedVersion":"4.12.12"}],"fix":{"url":"https://github.com/honojs/hono/commit/b470278920fffcfd6d76002755d6db53db827679","label":"honojs/hono@b470278"},"references":[{"type":"WEB","url":"https://github.com/honojs/hono/releases/tag/v4.12.12"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/39xxx/CVE-2026-39408.json"},{"type":"ADVISORY","url":"https://github.com/honojs/hono/security/advisories/GHSA-xf4j-xp2r-rqqx"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39408"},{"type":"FIX","url":"https://github.com/honojs/hono/commit/b470278920fffcfd6d76002755d6db53db827679"},{"type":"PACKAGE","url":"https://github.com/honojs/hono"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:16.575876900Z"}}