Loading...
Skip to main content

CVE-2024-29034 — Vulnerability in carrierwave — CVE Details

MEDIUM

CarrierWave content-Type allowlist bypass vulnerability which possibly leads to XSS remained

Published March 25, 2024Updated March 27, 2024Source: osv

Summary

### Impact The vulnerability [CVE-2023-49090](https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-gxhx-g4fq-49hj) 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 Upgrade to [3.0.7](https://rubygems.org/gems/carrierwave/versions/3.0.7) or [2.2.6](https://rubygems.org/gems/carrierwave/versions/2.2.6). ### Workarounds Use the following monkey patch to let CarrierWave parse the Content-type by using `Marcel::MimeType.for`. ```ruby # 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 ``` ```ruby # 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 [OWASP - File Upload Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html#content-type-validation)

Advisory Timeline

  • First published March 25, 2024 (931 days ago).
  • Last revised March 27, 2024 — 2 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update carrierwave to 3.0.7 or later
gem install carrierwave -v 3.0.7
Bundler
Update carrierwave to 2.2.6 or later
gem install carrierwave -v 2.2.6

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 1 ecosystem: rubygems (1).

PackageEcosystemAffectedFixed In
carrierwave
rubygems
3.0.0, 3.0.1, 3.0.2, 3.0.3 (+3 more)3.0.7
carrierwave
rubygems
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.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N

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. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-29034 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.8

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-vfmv-jfc5-pjjw

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies