# CVE-2024-43787: Hono CSRF middleware can be bypassed using crafted Content-Type header

> Attackers can bypass CSRF protection in the Hono framework by using uppercase MIME types in Content-Type headers, allowing unauthorized state-changing requests.

- **Severity:** Medium 5.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 22 Aug 2024
- **Updated:** 22 Aug 2024
- **Also known as:** GHSA-rpfr-3m35-5vx5

## What is CVE-2024-43787?

CVE-2024-43787 is a medium-severity vulnerability in honojs hono, published on 22 Aug 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Hono is a Web application framework that provides support for any JavaScript runtime. Hono CSRF middleware can be bypassed using crafted Content-Type header. MIME types are case insensitive, but isRequestedByFormElementRe only matches lower-case. As a result, attacker can bypass csrf middleware using upper-case form-like MIME type. This vulnerability is fixed in 4.5.8.

Weakness: CWE-352 (Cross-Site Request Forgery)

## Which versions are affected by CVE-2024-43787?

2 open source packages ship an affected version, including hono. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `hono` | npm | All versions | 4.5.8 |
| `hono` | npm | All versions | 4.5.8 |

Products: Hono Hono.

## How do I fix CVE-2024-43787?

Upgrade hono to 4.5.8 or later.

## Is CVE-2024-43787 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-43787 exists.

## Other vulnerabilities in honojs hono

- [CVE-2026-27700](https://insights.sbomify.com/CVE-2026-27700/): Hono is Vulnerable to Authentication Bypass by IP Spoofing in AWS Lambda ALB conninfo (high 8.2)
- [CVE-2026-22817](https://insights.sbomify.com/CVE-2026-22817/): JWT Algorithm Confusion via Unsafe Default (HS256) in Hono JWT Middleware Allows Token Forgery and Auth Bypass (high 8.2)
- [CVE-2026-22818](https://insights.sbomify.com/CVE-2026-22818/): JWT algorithm confusion in Hono JWK Auth Middleware when JWK lacks "alg" (untrusted header.alg fallback) (high 8.2)
- [CVE-2025-62610](https://insights.sbomify.com/CVE-2025-62610/): Hono Improperly Authorizes JWT Audience Validation (high 8.1)
- [CVE-2026-29045](https://insights.sbomify.com/CVE-2026-29045/): Hono: Arbitrary file access via serveStatic vulnerability (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-43787 and fix it if it is affected.

What it is: CVE-2024-43787 is a medium-severity vulnerability in honojs hono, published on 22 Aug 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-43787 exists.

Affected packages and fixed versions:
- hono (npm): affected all versions; fixed in 4.5.8
- hono (npm): affected all versions; fixed in 4.5.8

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-43787/ (Markdown: https://insights.sbomify.com/CVE-2024-43787/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-43787
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-43787
- OSV: https://osv.dev/vulnerability/CVE-2024-43787

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-43787/
Summaries are generated and may contain mistakes; the official description above is the record.
