Every CVE Search/ Get API key

CVE-2021-21305

Code Injection vulnerability in CarrierWave

7.4 HighFix available

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

13.2%Up 10.5 points since Apr 14, 2021
90%50%10%1%

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 HighCVSS: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 HighCVSS: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

Upgrade to 2.1.1 or 1.3.2.

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:

Record
GHSA-cf3w-g86h-35x4
CVSS 3.1
7.4 HighCVSS: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 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV: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 HighCVSS: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 HighCVSS: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

Upgrade to 2.1.1 or 1.3.2.

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:

Record
GHSA-cf3w-g86h-35x4
CVSS 3.1
7.4 HighCVSS: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 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L
CVSS 3.1
8.8 HighCVSS: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

Affected packages
PackageAffectedFixed
carrierwave
RubyGems
before 1.3.2
1.3.2
carrierwave
RubyGems
2.0.0 up to 2.1.1
2.1.1
ruby-carrierwave
Debian:12
before 1.3.2-1
1.3.2-1
carrierwave
RubyGems
before 1.3.2, plus listed versions
0.10.10.00.11.00.11.10.11.2
Show 45 moreShow less
0.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
carrierwave
RubyGems
2.0.0 up to 2.1.1, plus listed versions
2.0.12.0.22.1.0
2.1.1
ruby-carrierwave
Ubuntu:16.04:LTS
All versions, plus listed versions
0.10.0+gh-10.10.0+gh-2
None known
ruby-carrierwave
Ubuntu: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-carrierwave
Ubuntu: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-carrierwave
Ubuntu: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-carrierwave
Ubuntu: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-carrierwave
Ubuntu: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-carrierwave
Ubuntu: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

History
RecordedChangedSources
affected, facts
aliasesEUVD
first indexedCVE 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

Show 7 moreShow less
This page doesn't list everything

Left out here: 5 versions. The JSON record has them.

MoveEnter Open