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.
Czego dotyczy
Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.
| Platforma | Paczka | Podatne wersje | Poprawka w wersji |
|---|---|---|---|
| Paczka npm | hono | >= 4.0.0, < 4.12.12 | 4.12.12 |
Odnośniki
- Wektor CVSS
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- Słabość (CWE)
CWE-22- Platforma
- npm
- Paczka
hono- Ujawniono
- 08.04.2026
- Aktualizacja
- 11.10.2026 10:22
Źródła i licencje
OSV / GitHub Advisory Database - GHSA-xf4j-xp2r-rqqx - CC BY 4.0
Historia podatności: hono
Wszystkie opisane podatności tej paczki (Paczka npm), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.
- Wszystkich wpisów
- 52
- Pierwsza → ostatnia
- 12.2023 10.2026
- Bez poprawki
- 0
- Wykorzystywana w atakach
- 0
Rozkład istotności
- Wysoka 7
- Średnia 41
- Niska 4
Ujawnienia w latach
- 2023: 1
- 2024: 3
- 2025: 4
- 2026: 44
-
Hono: Path traversal in toSSG() allows writing files outside the output directory ten wpis
Dowiedz się, które podatności dotyczą Twojej aplikacji
Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.