Miggo Logo

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

5

CVSS Score
3.1

Basic Information

EPSS Score
0.03318%
Published
8/22/2024
Updated
11/18/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
hononpm< 4.5.84.5.8

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the case-sensitive regex pattern in the CSRF middleware's Content-Type validation. The key evidence is: 1) The original regex (/application\/x-www-form-urlencoded/) lacked the 'i' flag 2) The fix added case-insensitivity via /i modifier 3) The PoC demonstrates exploitation using uppercase 'Application/x-www-form-urlencoded' 4) The test case added in the commit specifically checks this bypass scenario. The middleware's security logic relied on this regex to trigger CSRF validation, making the regex implementation the root vulnerable component.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Summ*ry *ono *SR* mi**l*w*r* **n ** *yp*ss** usin* *r**t** *ont*nt-Typ* *****r. ### **t*ils MIM* typ*s *r* **s* ins*nsitiv*, *ut `isR*qu*st***y*orm*l*m*ntR*` only m*t***s low*r-**s*. *ttps://*it*u*.*om/*onojs/*ono/*lo*/***********************

Reasoning

T** vuln*r**ility st*ms *rom t** **s*-s*nsitiv* r***x p*tt*rn in t** *SR* mi**l*w*r*'s *ont*nt-Typ* v*li**tion. T** k*y *vi**n** is: *) T** ori*in*l r***x (`/*ppli**tion\/x-www-*orm-url*n*o***/`) l**k** t** 'i' *l** *) T** *ix ***** **s*-ins*nsitivit