CVE-2020-8165: Activesupport ActiveSupport Potentially Unintended Unmarshalling Of Vulnerability

CRITICAL
Advisory Identifier: GHSA-2p68-f74v-9wc6
CVSS 9.8
CWE-502
Published
Advisory Summary

CVE-2020-8165 is a CRITICAL (CVSS 9.8) activesupport potentially unintended unmarshalling of vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Activesupport libraries in the RubyGems ecosystem. The issue involves activesupport potentially unintended unmarshalling of user-provided objects in memcachestore and rediscachestore. Remediation is available by upgrading affected packages to version 5.2.4.3, 6.0.3.1.

CVE-2020-8165 at a Glance

CVE Identifier CVE-2020-8165
GHSA Identifier GHSA-2p68-f74v-9wc6
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Activesupport
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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

How to Fix CVE-2020-8165

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

activesupport fixed: 5.2.4.3
Upgrade activesupport to 5.2.4.3
activesupport fixed: 6.0.3.1
Upgrade activesupport to 6.0.3.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 activesupport

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-8165, inspect your project dependencies for Activesupport:

inspect dependencies for activesupport

Analyze the terminal output to locate any version of Activesupport in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.4.3), 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-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Activesupport, 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

In ActiveSupport, there is potentially unexpected behaviour in the MemCacheStore and RedisCacheStore where, when untrusted user input is written to the cache store using the `raw: true` parameter, re-reading the result from the cache can evaluate the user input as a Marshalled object instead of plain text. Vulnerable code looks like: ``` data = cache.fetch("demo", raw: true) { untrusted_string } ``` Versions Affected: rails < 5.2.5, rails < 6.0.4 Not affected: Applications not using MemCacheStore or RedisCacheStore. Applications that do not use the `raw` option when storing untrusted user input. Fixed Versions: rails >= 5.2.4.3, rails >= 6.0.3.1 Impact ------ Unmarshalling of untrusted user input can have impact up to and including RCE. At a minimum, this vulnerability allows an attacker to inject untrusted Ruby objects into a web application. In addition to upgrading to the latest versions of Rails, developers should ensure that whenever they are calling `Rails.cache.fetch` they are using consistent values of the `raw` parameter for both reading and writing, especially in the case of the RedisCacheStore which does not, prior to these changes, detect if data was serialized using the raw option upon deserialization. Workarounds ----------- It is recommended that application developers apply the suggested patch or upgrade to the latest release as soon as possible. If this is not possible, we recommend ensuring that all user-provided strings cached using the `raw` argument should be double-checked to ensure that they conform to the expected format.

CVE-2020-8165 Affected Activesupport Versions

2 component(s)
Fixed Versions:
5.2.4.36.0.3.1
Product / Package Ecosystem Affected Versions Fixed Version
activesupport
RubyGems
≥ 5.0.0
< 5.2.4.3
5.2.4.3
activesupport
RubyGems
≥ 6.0.0
< 6.0.3.1
6.0.3.1

References

Frequently Asked Questions

What is CVE-2020-8165?
CVE-2020-8165 is a security vulnerability in Activesupport involving ActiveSupport potentially unintended unmarshalling of user-provided objects in MemCacheStore and RedisCacheStore under CWE-502: Deserialization of Untrusted Data.
Which Activesupport versions are affected?
Affected versions include releases prior to 5.2.4.3, 6.0.3.1 across affected packages: activesupport.
What version fixes CVE-2020-8165?
Upgrading to 5.2.4.3, 6.0.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is activesupport affected?
Yes, activesupport is affected in releases prior to 5.2.4.3, 6.0.3.1. Upgrade your dependency to 5.2.4.3, 6.0.3.1 or later.
What is the CVSS score of CVE-2020-8165?
CVE-2020-8165 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-8165?
CVE-2020-8165 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check RubyGems dependencies for CVE-2020-8165?
Run the dependency tree command: 'inspect dependencies for activesupport'. 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-2p68-f74v-9wc6",
  "modified" : "2025-05-09T21:34:13Z",
  "published" : "2020-05-26T14:49:24Z",
  "aliases" : [ "CVE-2020-8165" ],
  "summary" : "ActiveSupport potentially unintended unmarshalling of user-provided objects in MemCacheStore and RedisCacheStore",
  "details" : "In ActiveSupport, there is potentially unexpected behaviour in the MemCacheStore and RedisCacheStore where, when\nuntrusted user input is written to the cache store using the `raw: true` parameter, re-reading the result\nfrom the cache can evaluate the user input as a Marshalled object instead of plain text. Vulnerable code looks like:\n\n```\ndata = cache.fetch(\"demo\", raw: true) { untrusted_string }\n```\nVersions Affected:  rails < 5.2.5, rails < 6.0.4\nNot affected:       Applications not using MemCacheStore or RedisCacheStore. Applications that do not use the `raw` option when storing untrusted user input.\nFixed Versions:     rails >= 5.2.4.3, rails >= 6.0.3.1\n  \nImpact\n------\nUnmarshalling of untrusted user input can have impact up to and including RCE. At a minimum,\nthis vulnerability allows an attacker to inject untrusted Ruby objects into a web application.\nIn addition to upgrading to the latest versions of Rails, developers should ensure that whenever\nthey are calling `Rails.cache.fetch` they are using consistent values of the `raw` parameter for both\nreading and writing, especially in the case of the RedisCacheStore which does not, prior to these changes,\ndetect if data was serialized using the raw option upon deserialization.\n\nWorkarounds\n-----------\nIt is recommended that application developers apply the suggested patch or upgrade to the latest release as\nsoon as possible. If this is not possible, we recommend ensuring that all user-provided strings cached using\nthe `raw` argument should be double-checked to ensure that they conform to the expected format.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activesupport"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.2.4.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.4.2"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activesupport"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.3.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.3"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-8165"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/413388"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activesupport/CVE-2020-8165.yml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/forum/#!topic/rubyonrails-security/bv6fW4S0Y1c"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/rubyonrails-security/c/bv6fW4S0Y1c"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/06/msg00022.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2020/07/msg00013.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20250509-0002"
  }, {
    "type" : "WEB",
    "url" : "https://weblog.rubyonrails.org/2020/5/18/Rails-5-2-4-3-and-6-0-3-1-have-been-released"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2020/dsa-4766"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00031.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00034.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-05-26T14:47:03Z",
    "nvd_published_at" : "2020-06-19T18:15:00Z"
  }
}