CVE-2021-31799:
Arbitrary Code Execution in Rdoc
7
CVSS ScoreBasic Information
CVE ID
GHSA ID
EPSS Score
-
CWE
Published
9/1/2021
Updated
10/16/2024
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
rdoc | rubygems | >= 3.11, < 6.1.2.1 | 6.1.2.1 |
rdoc | rubygems | >= 6.2.0, < 6.2.1.1 | 6.2.1.1 |
rdoc | rubygems | >= 6.3.0, < 6.3.1 | 6.3.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from using Kernel#open instead of File.open in the remove_unparseable method. Kernel#open interprets filenames starting with | as shell commands. The commit a7f5d6ab88632b3b482fe10611382ff73d14eed7 explicitly fixes this by replacing open with File.open, and the test case demonstrates exploitation via a filename containing | touch evil.txt && echo tags. This matches CWE-78 OS Command Injection patterns and the CVE description.