Loading...
Skip to main content

CVE-2021-21305 — Code Injection vulnerability in carrierwave — CVE...

HIGH

Code Injection vulnerability in CarrierWave::RMagick

Published February 8, 2021Updated July 8, 2026Source: osv

Summary

### Impact [CarrierWave::RMagick](https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/processing/rmagick.rb) has a Code Injection vulnerability. Its `#manipulate!` method inappropriately evals the content of mutation option(`:read`/`:write`), allowing attackers to craft a string that can be executed as a Ruby code. If an application developer supplies untrusted inputs to the option, it will lead to remote code execution(RCE). (But supplying untrusted input to the option itself is dangerous even in absence of this vulnerability, since is prone to DoS vulnerability - attackers can try to consume massive amounts of memory by resizing to a very large dimension) ### Proof of Concept ```ruby class MyUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick end MyUploader.new.manipulate!({ read: { density: "1 }; p 'Hacked'; {" }}) # => shows "Hacked" ``` ### Patches Upgrade to [2.1.1](https://rubygems.org/gems/carrierwave/versions/2.1.1) or [1.3.2](https://rubygems.org/gems/carrierwave/versions/1.3.2). ### Workarounds Stop supplying untrusted input to `#manipulate!`'s mutation option. ### References [Code Injection Software Attack](https://owasp.org/www-community/attacks/Code_Injection) ### For more information If you have any questions or comments about this advisory: * Open an issue in [CarrierWave repo](https://github.com/carrierwaveuploader/carrierwave) * Email me at [mit.shibuya@gmail.com](mailto:mit.shibuya@gmail.com)

Advisory Timeline

  • First published February 8, 2021 (2072 days ago).
  • Last revised July 8, 2026 — 1975 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update carrierwave to 1.3.2 or later
gem install carrierwave -v 1.3.2
Bundler
Update carrierwave to 2.1.1 or later
gem install carrierwave -v 2.1.1

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
0.1, 0.10.0, 0.11.0, 0.11.1 (+51 more)1.3.2
carrierwave
rubygems
2.0.0, 2.0.1, 2.0.2, 2.1.02.1.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

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

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

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

Frequently Asked Questions

What is CVE-2021-21305?
Code Injection vulnerability in CarrierWave::RMagick This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.4/10).
How do I check if my project is affected by CVE-2021-21305?
CVE-2021-21305 affects carrierwave. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-21305 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
7.4

High exploitability or significant impact. Prioritize remediation within days.

Also Known As

GHSA-cf3w-g86h-35x4

Related CVEs

  • CVE-2026-94462
    HIGH

    Spree: Broken Access Control in `PATCH /api/v3/store/carts/:id/associate` (IDOR)

  • CVE-2026-77601
    HIGH

    OpenC3 COSMOS: Authenticated OS command injection via the `pypi_url` setting

  • CVE-2026-44587
    MEDIUM

    CarrierWave has a denylisted_content_type bypass via Unescaped Regex Metacharacters

  • CVE-2023-49090
    MEDIUM

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

  • CVE-2024-29034
    MEDIUM

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

Check if you're affected

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

Scan Your Dependencies