Miggo Logo

CVE-2024-29034: CarrierWave content-Type allowlist bypass vulnerability which possibly leads to XSS remained

6.8

CVSS Score
3.1

Basic Information

EPSS Score
0.07682%
Published
3/25/2024
Updated
3/27/2024
KEV Status
No
Technology
TechnologyRuby

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
carrierwaverubygems>= 3.0.0, < 3.0.73.0.7
carrierwaverubygems< 2.2.62.2.6

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper Content-Type parsing in CarrierWave's sanitization logic. The commit diff shows critical changes to content type handling in sanitized_file.rb, replacing direct @file.content_type access with Marcel MIME type parsing. The vulnerable functions directly used the raw Content-Type header without properly extracting the primary MIME type, allowing attackers to bypass allowlists by providing multiple types (e.g., 'text/html, image/png'). Browser interpretation of the first valid MIME type while CarrierWave's validation saw the full string created the mismatch. The patch explicitly adds Marcel parsing and tests for multi-value scenarios, confirming these functions were the vulnerability source.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t T** vuln*r**ility [*V*-****-*****](*ttps://*it*u*.*om/**rri*rw*v*uplo***r/**rri*rw*v*/s**urity/**visori*s/**S*-*x*x-***q-***j) w*sn't *ully ***r*ss**. T*is vuln*r**ility is **us** *y t** ***t t**t w**n uplo**in* to o*j**t stor***, in*lu*i

Reasoning

T** vuln*r**ility st*ms *rom improp*r *ont*nt-Typ* p*rsin* in **rri*rW*v*'s s*nitiz*tion lo*i*. T** *ommit *i** s*ows *riti**l ***n**s to *ont*nt typ* **n*lin* in s*nitiz**_*il*.r*, r*pl**in* *ir**t @*il*.*ont*nt_typ* ****ss wit* M*r**l MIM* typ* p*r