CVE Vulnerabilities

CVE-2024-27281

Deserialization of Untrusted Data

Published: May 14, 2024 | Modified: Aug 20, 2024
CVSS 3.x
N/A
Source:
NVD
CVSS 2.x
RedHat/V2
RedHat/V3
4.5 MODERATE
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L
Ubuntu
MEDIUM

An issue was discovered in RDoc 6.3.3 through 6.6.2, as distributed in Ruby 3.x through 3.3.0. When parsing .rdoc_options (used for configuration in RDoc) as a YAML file, object injection and resultant remote code execution are possible because there are no restrictions on the classes that can be restored. (When loading the documentation cache, object injection and resultant remote code execution are also possible if there were a crafted cache.) The main fixed version is 6.6.3.1. For Ruby 3.0 users, a fixed version is rdoc 6.3.4.1. For Ruby 3.1 users, a fixed version is rdoc 6.4.1.1. For Ruby 3.2 users, a fixed version is rdoc 6.5.1.1.

Weakness

The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.

Affected Software

Name Vendor Start Version End Version
Red Hat Enterprise Linux 8 RedHat ruby:3.0-8100020240522072634.489197e6 *
Red Hat Enterprise Linux 8 RedHat ruby:3.1-8100020240510101534.489197e6 *
Red Hat Enterprise Linux 8 RedHat ruby:3.3-8100020240522151542.489197e6 *
Red Hat Enterprise Linux 8 RedHat ruby:2.5-8100020240627152904.489197e6 *
Red Hat Enterprise Linux 9 RedHat ruby:3.1-9040020240503183840.9 *
Red Hat Enterprise Linux 9 RedHat ruby:3.3-9040020240522171337.9 *
Red Hat Enterprise Linux 9 RedHat ruby-0:3.0.7-162.el9_4 *
Jruby Ubuntu mantic *
Jruby Ubuntu trusty/esm *
Ruby2.7 Ubuntu focal *
Ruby3.0 Ubuntu jammy *
Ruby3.1 Ubuntu mantic *
Ruby3.2 Ubuntu noble *

Extended Description

It is often convenient to serialize objects for communication or to save them for later use. However, deserialized data or code can often be modified without using the provided accessor functions if it does not use cryptography to protect itself. Furthermore, any cryptography would still be client-side security – which is a dangerous security assumption. Data that is untrusted can not be trusted to be well-formed. When developers place no restrictions on “gadget chains,” or series of instances and method invocations that can self-execute during the deserialization process (i.e., before the object is returned to the caller), it is sometimes possible for attackers to leverage them to perform unauthorized actions, like generating a shell.

Potential Mitigations

  • Make fields transient to protect them from deserialization.
  • An attempt to serialize and then deserialize a class containing transient fields will result in NULLs where the transient data should be. This is an excellent way to prevent time, environment-based, or sensitive variables from being carried over and used improperly.

References