Advisory Database
  • Advisories
  • Dependency Scanning
  1. gem
  2. ›
  3. activesupport
  4. ›
  5. CVE-2020-8165

CVE-2020-8165: ActiveSupport potentially unintended unmarshalling of user-provided objects in MemCacheStore and RedisCacheStore

May 26, 2020 (updated May 9, 2025)

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.

References

  • github.com/advisories/GHSA-2p68-f74v-9wc6
  • github.com/rubysec/ruby-advisory-db/blob/master/gems/activesupport/CVE-2020-8165.yml
  • groups.google.com/forum/
  • groups.google.com/g/rubyonrails-security/c/bv6fW4S0Y1c
  • hackerone.com/reports/413388
  • lists.debian.org/debian-lts-announce/2020/06/msg00022.html
  • lists.debian.org/debian-lts-announce/2020/07/msg00013.html
  • nvd.nist.gov/vuln/detail/CVE-2020-8165
  • security.netapp.com/advisory/ntap-20250509-0002
  • weblog.rubyonrails.org/2020/5/18/Rails-5-2-4-3-and-6-0-3-1-have-been-released
  • www.debian.org/security/2020/dsa-4766

Code Behaviors & Features

Detect and mitigate CVE-2020-8165 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 5.0.0 before 5.2.4.3, all versions starting from 6.0.0 before 6.0.3.1

Fixed versions

  • 5.2.4.3
  • 6.0.3.1

Solution

Upgrade to versions 5.2.4.3, 6.0.3.1 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-502: Deserialization of Untrusted Data

Source file

gem/activesupport/CVE-2020-8165.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:14:37 +0000.