CVE-2021-31799 — Arbitrary Code Execution in rdoc — CVE Details
Arbitrary Code Execution in Rdoc
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.48%). Schedule for your next planned update.
Does your project use an affected rdoc version?
Paste your Gemfile.lock to check it for CVE-2021-31799 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
In RDoc 3.11 through 6.x before 6.3.1, as distributed with Ruby through 3.0.1, it is possible to execute arbitrary code via | and tags in a filename.
Advisory Timeline
- First published September 1, 2021 (1912 days ago).
- Last revised November 14, 2024 — 1169 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install rdoc -v 6.3.1
gem install rdoc -v 6.1.2.1
gem install rdoc -v 6.2.1.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (3)
Affects 1 ecosystem: RubyGems (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-74
- CWE-77
- CWE-78OS Command InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.0 score means for each attack dimension.
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-31799ADVISORY
- https://github.com/ruby/rdoc/commit/a7f5d6ab88632b3b482fe10611382ff73d14eed7WEB
- https://github.com/ruby/rdocPACKAGE
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rdoc/CVE-2021-31799.ymlWEB
- https://lists.debian.org/debian-lts-announce/2021/10/msg00009.htmlWEB
- https://security-tracker.debian.org/tracker/CVE-2021-31799WEB
- https://security.gentoo.org/glsa/202401-05WEB
- https://security.netapp.com/advisory/ntap-20210902-0004WEB
- https://www.oracle.com/security-alerts/cpuapr2022.htmlWEB
- https://www.ruby-lang.org/en/news/2021/05/02/os-command-injection-in-rdocWEB
Frequently Asked Questions
- What is CVE-2021-31799?
- Arbitrary Code Execution in Rdoc. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.0/10).
- How do I check if my project is affected by CVE-2021-31799?
- CVE-2021-31799 affects rdoc. It has a 1.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-31799 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is an above-median EPSS score — 74.2% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-126366HIGH
msgpack-ruby JRuby decoder makes uncapped header-count allocations; a 5-byte message forces multi-GiB OOM
- CVE-2026-126081HIGH
Action Pack: Possible Strong Parameters Bypass in Parameters#each_key
- CVE-2024-27281LOW
RDoc RCE vulnerability with .rdoc_options