Skip to content
OpenAdvisories
Medium · 4.7 CVE-2026-44587 EUVD-2026-37515GHSA-7g26-2qgj-chfg

CarrierWave has a denylisted_content_type bypass via Unescaped Regex Metacharacters

Published Jun 16, 2026 · Updated Jun 17, 2026 · Assigned by GitHub_M

Description

CarrierWave is a framework to upload files from Ruby applications. In versions prior to 2.2.7 and 3.1.3, the content_type_denylist check fails to escape regex metacharacters in string entries, causing the denylist to silently not match the content types it is intended to block. In lib/carrierwave/uploader/content_type_denylist.rb:57, denylist entries are interpolated directly into a regex without Regexp.quote or anchoring, so an entry such as image/svg+xml becomes the pattern /image\/svg+xml/, in which + is treated as a quantifier rather than a literal character and therefore never matches the real MIME type image/svg+xml. This is inconsistent with the allowlist implementation, which correctly applies both Regexp.quote and a \A anchor. Other content types containing regex metacharacters, such as application/xhtml+xml, are affected as well. As a result, any application that relies on content_type_denylist to block image/svg+xml, most commonly to prevent stored XSS, is silently unprotected. An attacker can upload an SVG file containing arbitrary JavaScript; if the application serves that SVG inline from its own origin, the script executes in the victim's browser, resulting in stored XSS. This issue has been fixed in versions 2.2.7 and 3.1.3.

Affected products

VendorProductAffectedFixed
carrierwaveuploader carrierwave < 2.2.7, >= 3.0.0.rc, < 3.1.3 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 12 ruby-carrierwave No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 16.04 LTS ruby-carrierwave No fix yet —
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 24.04 LTS ruby-carrierwave No fix yet —
Ubuntu Pro 22.04 LTS ruby-carrierwave No fix yet —
Ubuntu Pro 20.04 LTS ruby-carrierwave No fix yet —
Ubuntu Pro 18.04 LTS ruby-carrierwave No fix yet —

Affected packages

EcosystemPackageAffectedFixedRecord
RubyGems carrierwave >= 3.0.0.beta, < 3.1.3 3.1.3 GHSA-7g26-2qgj-chfg
RubyGems carrierwave < 2.2.7 2.2.7 GHSA-7g26-2qgj-chfg

References