CVE-2024-29034 — Vulnerability in carrierwave — CVE Details
CarrierWave content-Type allowlist bypass vulnerability which possibly leads to XSS remained
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.63%). Schedule for your next planned update.
Does your project use an affected carrierwave version?
Paste your Gemfile.lock to check it for CVE-2024-29034 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Impact
The vulnerability CVE-2023-49090 wasn't fully addressed.
This vulnerability is caused by the fact that when uploading to object storage, including Amazon S3, it is possible to set a Content-Type value that is interpreted by browsers to be different from what's allowed by content_type_allowlist, by providing multiple values separated by commas.
This bypassed value can be used to cause XSS.
Patches
Workarounds
Use the following monkey patch to let CarrierWave parse the Content-type by using Marcel::MimeType.for.
# For CarrierWave 3.x
CarrierWave::SanitizedFile.class_eval do
def declared_content_type
@declared_content_type ||
if @file.respond_to?(:content_type) && @file.content_type
Marcel::MimeType.for(declared_type: @file.content_type.to_s.chomp)
end
end
end
# For CarrierWave 2.x
CarrierWave::SanitizedFile.class_eval do
def existing_content_type
if @file.respond_to?(:content_type) && @file.content_type
Marcel::MimeType.for(declared_type: @file.content_type.to_s.chomp)
end
end
end
References
Advisory Timeline
- First published March 25, 2024 (976 days ago).
- Last revised March 27, 2024 — 2 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install carrierwave -v 3.0.7
gem install carrierwave -v 2.2.6
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: RubyGems (1).
| Package | Fixed In |
|---|---|
| carrierwave RubyGems · Affected: 3.0.0, 3.0.1, 3.0.2, 3.0.3 (+3 more) | 3.0.7 |
| carrierwave RubyGems · Affected: 0.1, 0.10.0, 0.11.0, 0.11.1 (+66 more) | 2.2.6 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-436
- CWE-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N
References
- https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-vfmv-jfc5-pjjwWEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-29034ADVISORY
- https://github.com/carrierwaveuploader/carrierwave/commit/25b1c800d45ef8e78dc445ebe3bd8a6e3f0a3477WEB
- https://github.com/carrierwaveuploader/carrierwavePACKAGE
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/carrierwave/CVE-2024-29034.ymlWEB
Frequently Asked Questions
- What is CVE-2024-29034?
- CarrierWave content-Type allowlist bypass vulnerability which possibly leads to XSS remained. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.8/10).
- How do I check if my project is affected by CVE-2024-29034?
- CVE-2024-29034 affects carrierwave. It has a 0.6% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-29034 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 44.8% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2021-21305HIGH
Code Injection vulnerability in CarrierWave::RMagick
- CVE-2026-128084MEDIUM
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
- CVE-2026-44587MEDIUM
CarrierWave has a denylisted_content_type bypass via Unescaped Regex Metacharacters
- CVE-2023-49090MEDIUM
CarrierWave Content-Type allowlist bypass vulnerability, possibly leading to XSS
- CVE-2026-115472MEDIUM
Doorkeeper: When using public clients, any client can revoke any access token