Skip to content
RCE Disclosed report Intermediate CVE-2024-27281

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

RDoc parses its .rdoc_options configuration file and its documentation cache as YAML without restricting which classes can be restored, so a crafted file can trigger object injection. An attacker who supplies a repository containing such a file could achieve remote code execution when the victim runs the rdoc command on it.

ooooooo_q Follow

Originally disclosed on HackerOne

Bounty$4,860 High View original
  • Triaged in 17 hours
  • Fixed in 41 hours
  • Paid in 41 hours
  • Disclosed after 48 hours

Summary by the program

RDoc RCE vulnerability with .rdoc_options

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.

We recommend to update the RDoc gem to version 6.6.3.1 or later. In order to ensure compatibility with bundled version in older Ruby series, you may update as follows instead:

For Ruby 3.0 users: Update to rdoc 6.3.4.1 For Ruby 3.1 users: Update to rdoc 6.4.1.1 For Ruby 3.2 users: Update to rdoc 6.5.1.1 You can use gem update rdoc to update it. If you are using bundler, please add gem "rdoc", ">= 6.6.3.1" to your Gemfile.

Note: 6.3.4, 6.4.1, 6.5.1 and 6.6.3 have a incorrect fix. We recommend to upgrade 6.3.4.1, 6.4.1.1, 6.5.1.1 and 6.6.3.1 instead of them.

Full GHSA: https://github.com/advisories/GHSA-592j-995h-p23j

The report

I made a report at https://hackerone.com/reports/1187477

https://www.ruby-lang.org/en/news/2024/03/21/rce-rdoc-cve-2024-27281/

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.

Impact

RCE is possible when the rdoc command is executed for a repository received from the external.

The original report as published on HackerOne, by ooooooo_q. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the YAML loader used for .rdoc_options and the documentation cache permits arbitrary object deserialisation instead of only plain data types.

Impact

Remote code execution is possible when the rdoc command is run against a repository received from an external source.

What the attacker needed

Victim runs rdoc on an untrusted repo; crafted .rdoc_options or cache file

The fix

It was fixed by updating the RDoc gem to [redacted] or later, or the matching patched version for older Ruby series, since the earlier patch releases contained an incorrect fix.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

RDoc is a tool that turns Ruby source code comments into documentation. It reads a small settings file and a saved cache, and it loads them in a way that lets the file name any program object it likes, including ones that run commands. So a file hidden in a project you download can run code on your machine when you build the docs.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by ooooooo_q

View all

53 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.