# CVE-2024-27281: RDoc RCE vulnerability with .rdoc_options

> Attackers can achieve remote code execution by exploiting unsafe YAML deserialization in RDoc configuration files or documentation caches.

- **Severity:** Medium 4.5 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 8 May 2024
- **Updated:** 4 Nov 2025
- **Also known as:** ALPINE-CVE-2024-27281, AZL-40523, AZL-40675, BELL-CVE-2024-27281, CLEANSTART-2026-GN52279, CLSA-2025-1753375058, DEBIAN-CVE-2024-27281, GHSA-592j-995h-p23j, UBUNTU-CVE-2024-27281, USN-6838-2

## What is CVE-2024-27281?

CVE-2024-27281 is a medium-severity unsafe deserialization vulnerability in n/a, published on 8 May 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

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: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2024-27281?

8 open source packages ship an affected version, including rdoc.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `rdoc` | RubyGems | From 6.3.3 | 6.3.4.1 |
| `rdoc` | RubyGems | From 6.3.3 | 6.3.4.1 |
| `rdoc` | RubyGems | From 6.4.0 | 6.4.1.1 |
| `rdoc` | RubyGems | From 6.4.0 | 6.4.1.1 |
| `rdoc` | RubyGems | From 6.5.0 | 6.5.1.1 |
| `rdoc` | RubyGems | From 6.5.0 | 6.5.1.1 |
| `rdoc` | RubyGems | From 6.6.0 | 6.6.3.1 |
| `rdoc` | RubyGems | From 6.6.0 | 6.6.3.1 |

## How do I fix CVE-2024-27281?

Upgrade rdoc to a fixed version for your release line: 6.3.4.1, 6.4.1.1, 6.5.1.1 or 6.6.3.1.

## Is CVE-2024-27281 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-27281 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-27281 and fix it if it is affected.

What it is: CVE-2024-27281 is a medium-severity unsafe deserialization vulnerability in n/a, published on 8 May 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-27281 exists.

Affected packages and fixed versions:
- rdoc (RubyGems): affected from 6.3.3; fixed in 6.3.4.1
- rdoc (RubyGems): affected from 6.3.3; fixed in 6.3.4.1
- rdoc (RubyGems): affected from 6.4.0; fixed in 6.4.1.1
- rdoc (RubyGems): affected from 6.4.0; fixed in 6.4.1.1
- rdoc (RubyGems): affected from 6.5.0; fixed in 6.5.1.1
- rdoc (RubyGems): affected from 6.5.0; fixed in 6.5.1.1
- rdoc (RubyGems): affected from 6.6.0; fixed in 6.6.3.1
- rdoc (RubyGems): affected from 6.6.0; fixed in 6.6.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-27281/ (Markdown: https://insights.sbomify.com/CVE-2024-27281/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-27281
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-27281
- OSV: https://osv.dev/vulnerability/CVE-2024-27281

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-27281/
Summaries are generated and may contain mistakes; the official description above is the record.
