Hono: Path traversal in toSSG() allows writing files outside the output directory
Summary
A 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.
Details
The 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.
For example:
import { Hono } from 'hono'
import { toSSG, ssgParams } from 'hono/ssg'
const app = new Hono()
app.get('/:id', ssgParams([{ id: '../pwned' }]), (c) => {
return c.text('pwned')
})
toSSG(app, fs, { dir: './static' })
In this case, the generated output path may resolve outside ./static, resulting in a file being written outside the intended output directory.
Impact
An attacker who can influence values passed to ssgParams during the build process may be able to write files outside the intended output directory.
Depending on the build and deployment environment, this may:
- overwrite unintended files
- affect generated artifacts
- impact deployment outputs or downstream tooling
This issue is limited to build-time static site generation and does not affect request-time routing.
Affected Packages
| Ecosystem | Package | Vulnerable Versions | Patched Version |
|---|---|---|---|
| npm |
hono
|
>= 4.0.0, <= 4.12.11 |
4.12.12
|
deps(deps): bump the security-patches group across 4 directories with 2 updates
Open 14 days agochore(deps): bump the npm_and_yarn group across 11 directories with 24 updates
Open 15 days agodeps(deps): bump the security-patches group across 4 directories with 2 updates
Closed 15 days agobuild(deps): Bump the npm_and_yarn group across 1 directory with 15 updates
Closed 15 days agochore(deps): bump the npm_and_yarn group across 5 directories with 23 updates
Closed 15 days agochore(deps): bump the npm_and_yarn group across 24 directories with 5 updates
Open 16 days agoBump the npm_and_yarn group across 5 directories with 7 updates
Open 16 days agoBump the npm_and_yarn group across 4 directories with 9 updates
Closed 16 days agobuild(deps): bump the npm_and_yarn group across 2 directories with 5 updates
Open 16 days agochore(deps): bump the npm_and_yarn group across 9 directories with 8 updates
Closed 16 days agochore(deps): Bump the npm_and_yarn group across 4 directories with 5 updates
Closed 17 days agoBump the npm_and_yarn group across 4 directories with 7 updates
Open 17 days agochore(deps): bump the npm_and_yarn group across 15 directories with 10 updates
Closed 18 days agochore(deps): bump the npm_and_yarn group across 15 directories with 9 updates
Closed 18 days agoBump the npm_and_yarn group across 19 directories with 5 updates
Open 19 days agoBump the npm_and_yarn group across 1 directory with 5 updates
Closed 20 days agobuild(deps): bump hono from 4.12.9 to 4.12.15 in /server
Open 20 days agoBump the npm_and_yarn group across 18 directories with 4 updates
Open 20 days agobuild(deps): bump the minor-and-patch group across 1 directory with 7 updates
Closed 20 days agoBump hono from 4.6.0 to 4.12.15 in /backend
Closed 21 days agodeps: bump hono from 4.12.10 to 4.12.15
Open 21 days agochore(deps): bump the all-minor-and-patch group across 1 directory with 26 updates
Open 21 days agodeps(deps): bump the security-patches group across 3 directories with 2 updates
Open 21 days agochore(deps): bump the minor-and-patch group across 1 directory with 25 updates
Closed 21 days agochore(deps): bump the production group across 1 directory with 12 updates
Open 21 days agochore(deps): bump the npm_and_yarn group across 1 directory with 3 updates
Open 21 days agochore(deps): Bump hono from 4.11.4 to 4.12.14
Closed 21 days agochore(deps): bump the dependencies group across 1 directory with 6 updates
Closed 21 days agobuild(deps): bump the npm_and_yarn group across 9 directories with 9 updates
Closed 21 days agochore(deps): bump the npm_and_yarn group across 1 directory with 5 updates
Closed 21 days agoBump hono from 4.12.3 to 4.12.15
Closed 21 days agochore(deps)(deps): bump hono from 4.11.2 to 4.12.15
Open 21 days agochore(deps): Bump the npm-non-major group across 1 directory with 8 updates
Open 22 days agoBump the npm_and_yarn group across 5 directories with 5 updates
Closed 22 days agodeps(api)(deps): bump hono from 4.11.9 to 4.12.15 in /cloudflare/forgescan-api in the hono group
Open 22 days agochore(deps): bump the production-dependencies group across 1 directory with 6 updates
Open 22 days agochore(deps): bump the all-minor-patch group across 1 directory with 23 updates
Open 22 days agochore(deps): Bump hono from 4.6.0 to 4.12.15
Open 22 days agodeps: Bump the minor-and-patch group across 1 directory with 12 updates
Open 22 days agochore(deps): bump hono from 4.12.9 to 4.12.15
Open 22 days agoBump the npm_and_yarn group across 1 directory with 5 updates
Open 22 days agoBump hono from 4.12.9 to 4.12.15
Closed 22 days agobuild(deps): bump the npm_and_yarn group across 1 directory with 23 updates
Open 22 days agochore(deps): bump hono from 4.12.8 to 4.12.15 in /frontend
Closed 22 days agochore(deps): bump hono from 4.12.10 to 4.12.15 in /dashboard
Open 22 days agochore(deps): Bump hono from 4.12.10 to 4.12.15 in /apps/translator/server in the minor-and-patch group across 1 directory
Closed 23 days agoBump hono from 4.12.6 to 4.12.15
Open 23 days agochore(deps): Bump the npm_and_yarn group across 1 directory with 2 updates
Closed 23 days agochore(deps): bump hono from 3.11.8 to 4.12.14 in the npm_and_yarn group across 1 directory
Closed 24 days agoBump the npm_and_yarn group across 1 directory with 12 updates
Open 24 days agoActions
Advisory Details
| Published: | April 08, 2026 about 1 month ago |
| Updated: | May 11, 2026 8 days ago |
| CVSS Score: | 5.9 CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N |
| EPSS: | 0.02% 4th percentile |
| Source: | Github |
| Classification: | GENERAL |
| UUID: | GSA_kwCzR0hTQS14ZjRqLXhwMnItcnFxeM4ABU3m |
PR Statistics
References
- https://github.com/honojs/hono/security/advisories/GHSA-xf4j-xp2r-rqqx
- https://github.com/honojs/hono/commit/b470278920fffcfd6d76002755d6db53db827679
- https://github.com/honojs/hono/releases/tag/v4.12.12
- https://nvd.nist.gov/vuln/detail/CVE-2026-39408
- https://github.com/advisories/GHSA-xf4j-xp2r-rqqx