CVE-2021-21288: Carrierwave Server-side Request Forgery Vulnerability

MODERATE
Advisory Identifier: GHSA-fwcm-636p-68r5
CVSS 4.3
CWE-918
Published
Advisory Summary

CVE-2021-21288 is a MODERATE (CVSS 4.3) server-side request forgery vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Carrierwave libraries in the RubyGems ecosystem. The issue involves server-side request forgery in carrierwave. Remediation is available by upgrading affected packages to version 1.3.2, 2.1.1.

CVE-2021-21288 at a Glance

CVE Identifier CVE-2021-21288
GHSA Identifier GHSA-fwcm-636p-68r5
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Carrierwave
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 4.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-21288

To remediate this vulnerability, upgrade all affected Carrierwave dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

carrierwave fixed: 1.3.2
Upgrade carrierwave to 1.3.2
carrierwave fixed: 2.1.1
Upgrade carrierwave to 2.1.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for carrierwave

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-21288, inspect your project dependencies for Carrierwave:

inspect dependencies for carrierwave

Analyze the terminal output to locate any version of Carrierwave in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Carrierwave, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact [CarrierWave download feature](https://github.com/carrierwaveuploader/carrierwave#uploading-files-from-a-remote-location) has an SSRF vulnerability, allowing attacks to provide DNS entries or IP addresses that are intended for internal use and gather information about the Intranet infrastructure of the platform. ### 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 Using proper network segmentation and applying the principle of least privilege to outbound connections from application servers can reduce the severity of SSRF vulnerabilities. Ideally the vulnerable gem should run on an isolated server without access to any internal network resources or cloud metadata access. ### References [Server-Side Request Forgery Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html) ### 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)

CVE-2021-21288 Affected Carrierwave Versions

2 component(s)
Fixed Versions:
1.3.22.1.1
Product / Package Ecosystem Affected Versions Fixed Version
carrierwave
RubyGems
< 1.3.2
1.3.2
carrierwave
RubyGems
≥ 2.0.0
< 2.1.1
2.1.1

References

Frequently Asked Questions

What is CVE-2021-21288?
CVE-2021-21288 is a security vulnerability in Carrierwave involving Server-side request forgery in CarrierWave under CWE-918: Server-Side Request Forgery (SSRF).
Which Carrierwave versions are affected?
Affected versions include releases prior to 1.3.2, 2.1.1 across affected packages: carrierwave.
What version fixes CVE-2021-21288?
Upgrading to 1.3.2, 2.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is carrierwave affected?
Yes, carrierwave is affected in releases prior to 1.3.2, 2.1.1. Upgrade your dependency to 1.3.2, 2.1.1 or later.
What is the CVSS score of CVE-2021-21288?
CVE-2021-21288 has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-21288?
CVE-2021-21288 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check RubyGems dependencies for CVE-2021-21288?
Run the dependency tree command: 'inspect dependencies for carrierwave'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fwcm-636p-68r5",
  "modified" : "2023-05-16T15:41:50Z",
  "published" : "2021-02-08T19:16:26Z",
  "aliases" : [ "CVE-2021-21288" ],
  "summary" : "Server-side request forgery in CarrierWave",
  "details" : "### Impact\n[CarrierWave download feature](https://github.com/carrierwaveuploader/carrierwave#uploading-files-from-a-remote-location) has an SSRF vulnerability, allowing attacks to provide DNS entries or IP addresses that are intended for internal use and gather information about the Intranet infrastructure of the platform.\n\n### Patches\nUpgrade 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).\n\n### Workarounds\nUsing proper network segmentation and applying the principle of least privilege to outbound connections from application servers can reduce the severity of SSRF vulnerabilities. Ideally the vulnerable gem should run on an isolated server without access to any internal network resources or cloud metadata access.\n\n### References\n[Server-Side Request Forgery Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [CarrierWave repo](https://github.com/carrierwaveuploader/carrierwave)\n* Email me at [mit.shibuya@gmail.com](mailto:mit.shibuya@gmail.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "carrierwave"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "carrierwave"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-fwcm-636p-68r5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21288"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/carrierwaveuploader/carrierwave/commit/012702eb3ba1663452aa025831caa304d1a665c0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/carrierwaveuploader/carrierwave"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md#132---2021-02-08"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md#211---2021-02-08"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/carrierwave/CVE-2021-21288.yml"
  }, {
    "type" : "WEB",
    "url" : "https://rubygems.org/gems/carrierwave"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-02-08T18:51:29Z",
    "nvd_published_at" : "2021-02-08T20:15:00Z"
  }
}