Advisory

GHSA-gxhx-g4fq-49hj

Also known as: CVE-2023-49090

Summary

CarrierWave Content-Type allowlist bypass vulnerability, possibly leading to XSS

Details

Impact
CarrierWave::Uploader::ContentTypeAllowlist has a Content-Type allowlist bypass vulnerability, possibly leading to XSS.

The validation in allowlisted_content_type? determines Content-Type permissions by performing a partial match.
If the content_type argument of allowlisted_content_type? is passed a value crafted by the attacker, Content-Types not included in the content_type_allowlist will be allowed.

In addition, by setting the Content-Type configured by the attacker at the time of file delivery, it is possible to cause XSS on the user's browser when the uploaded file is opened.

Patches
Upgrade to 3.0.5 or 2.2.5.

Workarounds
When validating with allowlisted_content_type? in CarrierWave::Uploader::ContentTypeAllowlist , forward match(\A) the Content-Type set in content_type_allowlist, preventing unintentional permission of text/html;image/png when you want to allow only image/png in content_type_allowlist.

References
OWASP - File Upload Cheat Sheet

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2023-11-29 21:33 UTC
Modified
2023-11-29 21:33 UTC

Affected packages and fixes

carrierwave

RubyGems · All systems

Affected

  • introduced 3.0.0, fixed 3.0.5 (ecosystem)

Fixed versions

3.0.5

Fix

The export has no generic command for this ecosystem.

carrierwave

RubyGems · All systems

Affected

  • introduced 0, fixed 2.2.5 (ecosystem)

Fixed versions

2.2.5

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences