CVE-2021-21305
Code Injection vulnerability in CarrierWave
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
7.4
Code Injection vulnerability in CarrierWave
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
CVE-2021-21305- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - Weakness
- CWE-74
- Updated
- 2026-11-02
EUVDEUVD-2021-0545
7.4
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
EUVD-2021-0545- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-cf3w-g86h-35x4
7.4
Code Injection vulnerability in CarrierWave::RMagick
Impact
CarrierWave::RMagick 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
class MyUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
end
MyUploader.new.manipulate!({ read: { density: "1 }; p 'Hacked'; {" }}) # => shows "Hacked"
Patches
Workarounds
Stop supplying untrusted input to #manipulate!'s mutation option.
References
Code Injection Software Attack
For more information
If you have any questions or comments about this advisory:
- Open an issue in CarrierWave repo
- Email me at [email protected]
- Record
GHSA-cf3w-g86h-35x4- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
NVD
7.4
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
CVE-2021-21305- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 7.5 High
AV:N/AC:L/Au:N/C:P/I:P/A:P - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
OSV
8.8
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
CVE-2021-21305- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-21305
8.8
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
DEBIAN-CVE-2021-21305- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-cf3w-g86h-35x4
7.4
Code Injection vulnerability in CarrierWave::RMagick
Impact
CarrierWave::RMagick 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
class MyUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
end
MyUploader.new.manipulate!({ read: { density: "1 }; p 'Hacked'; {" }}) # => shows "Hacked"
Patches
Workarounds
Stop supplying untrusted input to #manipulate!'s mutation option.
References
Code Injection Software Attack
For more information
If you have any questions or comments about this advisory:
- Open an issue in CarrierWave repo
- Email me at [email protected]
- Record
GHSA-cf3w-g86h-35x4- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-21305
7.4
CarrierWave is an open-source RubyGem which provides a simple and flexible way to upload files from Ruby applications. In CarrierWave before versions 1.3.2 and 2.1.1, there is a code injection vulnerability. The "#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). This is fixed in versions 1.3.2 and 2.1.1.
- Record
UBUNTU-CVE-2021-21305- CVSS 3.1
- 7.4 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L - CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVUSN-7497-1 No score
ruby-carrierwave vulnerabilities
Rikita Ishikawa discovered that CarrierWave did not correctly sanitize certain inputs. An attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 18.04 LTS and Ubuntu 20.04 LTS. (CVE-2021-21305)
Norihide Saito discovered that CarrierWave did not correctly sanitize certain inputs. An attacker could possibly use this issue to execute a cross-site scripting (XSS) attack. (CVE-2023-49090)
- Record
USN-7497-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
carrierwaveRubyGems |
before 1.3.2 | 1.3.2 |
carrierwaveRubyGems |
2.0.0 up to 2.1.1 | 2.1.1 |
ruby-carrierwaveDebian:12 |
before 1.3.2-1 | 1.3.2-1 |
carrierwaveRubyGems |
before 1.3.2, plus listed versions 0.10.10.00.11.00.11.10.11.2 Show 45 moreShow less0.2.00.2.10.2.30.2.40.3.00.3.10.3.20.3.30.3.40.3.50.3.5.10.3.5.20.4.00.4.10.4.100.4.20.4.30.4.40.4.50.4.60.4.70.4.80.4.90.5.00.5.0.beta20.5.10.5.20.5.30.5.40.5.50.5.60.5.70.5.80.6.00.6.10.6.20.7.00.7.10.8.00.9.01.0.01.0.0.beta1.0.0.rc1.1.01.2.0 |
1.3.2 |
carrierwaveRubyGems |
2.0.0 up to 2.1.1, plus listed versions 2.0.12.0.22.1.0 |
2.1.1 |
ruby-carrierwaveUbuntu:16.04:LTS |
All versions, plus listed versions 0.10.0+gh-10.10.0+gh-2 |
None known |
ruby-carrierwaveUbuntu:Pro:18.04:LTS |
before 1.2.2-1ubuntu0.1~esm1, plus listed versions 0.10.0+gh-41.1.0-31.2.2-1 |
1.2.2-1ubuntu0.1~esm1 |
ruby-carrierwaveUbuntu:Pro:20.04:LTS |
before 1.3.1-2ubuntu0.1~esm1, plus listed versions 1.3.1-2 |
1.3.1-2ubuntu0.1~esm1 |
ruby-carrierwaveUbuntu:Pro:18.04:LTS From an advisory covering 2 CVEs |
before 1.2.2-1ubuntu0.1~esm1, plus listed versions 0.10.0+gh-41.1.0-31.2.2-1 |
1.2.2-1ubuntu0.1~esm1 |
ruby-carrierwaveUbuntu:Pro:20.04:LTS From an advisory covering 2 CVEs |
before 1.3.1-2ubuntu0.1~esm1, plus listed versions 1.3.1-2 |
1.3.1-2ubuntu0.1~esm1 |
ruby-carrierwaveUbuntu:Pro:22.04:LTS From an advisory covering 2 CVEs |
before 1.3.2-2ubuntu0.22.04.1~esm1, plus listed versions 1.3.2-2 |
1.3.2-2ubuntu0.22.04.1~esm1 |
ruby-carrierwaveUbuntu:Pro:24.04:LTS From an advisory covering 2 CVEs |
before 1.3.2-2ubuntu0.24.04.1~esm1, plus listed versions 1.3.2-2 |
1.3.2-2ubuntu0.24.04.1~esm1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-21305 is a high vulnerability (CVSS 7.4) in Carrierwave Project Carrierwave, published February 8, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 13.2%, the 96th percentile. Fixed in carrierwave 1.3.2.
References
github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md
github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-cf3w-g86h-35x4
rubygems.org/gems/carrierwave
github.com/carrierwaveuploader/carrierwave/commit/387116f5c72efa42bc3938d946b4c8d2f22181b7
nvd.nist.gov/vuln/detail/CVE-2021-21305
github.com/rubysec/ruby-advisory-db/blob/master/gems/carrierwave/CVE-2021-21305.yml
Left out here: 5 versions. The JSON record has them.