Skip to content
Fencer Vulns
high 7.0

CVE-2021-31799 json

Arbitrary Code Execution in Rdoc

published 2021-07-29 5 y ago modified 2026-06-17 4 mo ago also EUVD-2021-2060 , GHSA-ggxm-pgc9-g7fp

cvss
7.0
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
1.5%
EPSS 1.5% chance of exploitation in 30 days, percentile 74%
public exploits
0
none known

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.

Patch / fix

  • rubygems rdoc 6.1.2.1, 6.2.1.1, 6.3.1
  • ruby-lang rdoc 6.1.2.1, 6.2.1.1, 6.3.1
  • ruby2.7 Debian 11 2.7.4-1

debian advisories DEBIAN-CVE-2021-31799

  • ruby2.5 Ubuntu 18.04 LTS 2.5.1-1ubuntu1.10
  • ruby2.7 Ubuntu 20.04 LTS 2.7.0-5ubuntu1.5
  • ruby2.3 Ubuntu Pro 16.04 LTS 2.3.1-2~ubuntu16.04.16+esm1

ubuntu advisories UBUNTU-CVE-2021-31799

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • rubygem-pg RHEL 8, RHEL 8.4 EUS, RHEL 8.2 EUS +1 more 1.1.4-1.module+el8.1.0+3653+beb38eb0
  • rubygem-abrt RHEL 8, RHEL 8.4 EUS, RHEL 8.2 EUS +1 more 0.3.0-4.module+el8.1.0+3653+beb38eb0
  • rubygem-bson RHEL 8, RHEL 8.4 EUS, RHEL 8.2 EUS +1 more 4.5.0-1.module+el8.1.0+3653+beb38eb0
  • rubygem-mongo RHEL 8, RHEL 8.4 EUS, RHEL 8.2 EUS +1 more 2.8.0-1.module+el8.1.0+3653+beb38eb0
  • rh-ruby26-ruby RHEL 3 SOFTWARE_COLLECTIONS 2.6.9-120.el7
  • rh-ruby26-rubygems RHEL 3 SOFTWARE_COLLECTIONS 3.0.3.1-120.el7
  • rh-ruby26-ruby-libs RHEL 3 SOFTWARE_COLLECTIONS 2.6.9-120.el7
  • rh-ruby26-rubygem-irb RHEL 3 SOFTWARE_COLLECTIONS 1.0.0-120.el7

red hat advisories RHSA-2022:0582RHSA-2022:0581RHSA-2022:0708RHSA-2022:0672RHSA-2022:0544RHSA-2022:0543

  • ruby2.5 SLES for SAP 15 SP2, SLES for SAP 15 SP1, SLES for SAP 15 +21 more 2.5.9-150000.4.23.1
  • ruby2.5 SLES for SAP 15 SP1, SLES for SAP 15, SLES 15-LTSS +10 more 2.5.9-4.20.1
  • ruby2.1 SLES for SAP 12 SP5, SLES for SAP 12 SP4, SLES for SAP 12 SP3 +11 more 2.1.9-19.6.1

suse advisories SUSE-SU-2022:1512-1SUSE-SU-2021:3838-1SUSE-SU-2021:3837-1

  • ruby4.0 openSUSE Tumbleweed 4.0.0~preview2-1.1
  • ruby3.4 openSUSE Tumbleweed 3.4.1-1.1
  • ruby2.7 openSUSE Tumbleweed 2.7.4-1.1
  • ruby3.0 openSUSE Tumbleweed 3.0.2-1.1
  • ruby3.1 openSUSE Tumbleweed 3.1.0-1.1
  • ruby3.2 openSUSE Tumbleweed 3.2.1-1.1
  • ruby3.3 openSUSE Tumbleweed 3.3.0-1.2
  • ruby2.5 openSUSE Leap 15.2 2.5.9-lp152.2.9.1

opensuse advisories openSUSE-SU-2025:15819-1openSUSE-SU-2025:14621-1openSUSE-SU-2024:11622-1openSUSE-SU-2024:11623-1openSUSE-SU-2024:11786-1openSUSE-SU-2024:12712-1

  • ruby AlmaLinux 8 2.5.9-109.module_el8.5.0+2627+d9c243ca
  • ruby AlmaLinux 8 2.5.9-109.module_el8.5.0+259+8cec6917
  • ruby-irb AlmaLinux 8 2.5.9-109.module_el8.5.0+259+8cec6917
  • ruby-irb AlmaLinux 8 2.5.9-109.module_el8.5.0+2627+d9c243ca
  • rubygems AlmaLinux 8 2.7.6.3-109.module_el8.5.0+2627+d9c243ca
  • rubygems AlmaLinux 8 2.7.6.3-109.module_el8.5.0+259+8cec6917
  • ruby-libs AlmaLinux 8 2.5.9-109.module_el8.5.0+2627+d9c243ca
  • ruby-libs AlmaLinux 8 2.5.9-109.module_el8.5.0+259+8cec6917

almalinux advisories ALSA-2022:0672ALSA-2022:0543ALSA-2021:3020

  • ruby Rocky Linux 8 2.5.9-109.module+el8.5.0+740+b85cbe0d
  • rubygem-pg Rocky Linux 8 1.0.0-2.module+el8.4.0+592+03ff458a
  • rubygem-pg Rocky Linux 8 1.0.0-2.module+el8.3.0+167+5c390590
  • rubygem-abrt Rocky Linux 8 0.3.0-4.module+el8.5.0+738+032c9c02
  • rubygem-abrt Rocky Linux 8 0.3.0-4.module+el8.3.0+167+5c390590
  • rubygem-abrt Rocky Linux 8 0.3.0-4.module+el8.4.0+592+03ff458a
  • rubygem-bson Rocky Linux 8 4.3.0-2.module+el8.4.0+592+03ff458a
  • rubygem-bson Rocky Linux 8 4.3.0-2.module+el8.3.0+167+5c390590

rocky linux advisories RLSA-2022:0672RLSA-2022:0543RLSA-2021:3020

  • ruby Alpine 3.11 2.6.8-r0
  • ruby Alpine 3.24, Alpine 3.23, Alpine 3.22 +10 more 2.7.4-r0

alpine advisories ALPINE-CVE-2021-31799

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • ruby-rdoc Arch Linux 6.3.1-1
  • gitlab-gitaly Arch Linux 14.2.2-1
  • jruby Arch Linux 9.3.0.0-1
  • gitlab Arch Linux 14.0.3-1

arch linux advisories AVG-1901AVG-1905AVG-1906AVG-2125

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2021-31799 updated cvss 7.0

rubygem-rdoc: Command injection vulnerability in RDoc

  • Red Hat 3scale API Management Platform 2 system
    affected: no fix available “Fix deferred”
  • Red Hat Enterprise Linux 7 ruby, ruby-irb, rubygems, ruby-libs, ruby-tcltk, rubygem-json, +6 more
    affected: no fix planned “Out of support scope”
  • Red Hat Enterprise Linux AppStream (v. 8) ruby 2.5.9-109.module+el8.5.0+14275+d9c243ca, ruby 2.6.9-108.module+el8.5.0+13719+08a8ba32, ruby 2.7.4-137.module+el8.4.0+12025+f744ca41, rubygem-pg 1.0.0-2.module+el8.1.0+3656+f80bfa1d, rubygem-pg 1.1.4-1.module+el8.1.0+3653+beb38eb0, rubygem-pg 1.2.3-1.module+el8.3.0+7192+4e3a532a, +63 more
    fixed: vendor fix RHSA-2021:3020
  • Red Hat Enterprise Linux AppStream E4S (v. 8.1) ruby 2.6.9-107.module+el8.1.0+14088+04cf326e, rubygem-pg 1.1.4-1.module+el8.1.0+3653+beb38eb0, ruby-libs 2.6.9-107.module+el8.1.0+14088+04cf326e, rubygem-abrt 0.3.0-4.module+el8.1.0+3653+beb38eb0, rubygem-bson 4.5.0-1.module+el8.1.0+3653+beb38eb0, rubygem-mongo 2.8.0-1.module+el8.1.0+3653+beb38eb0, +17 more
    fixed: vendor fix RHSA-2022:0581
  • Red Hat Enterprise Linux AppStream EUS (v. 8.2) ruby 2.6.9-107.module+el8.2.0+14086+86d863af, rubygem-pg 1.1.4-1.module+el8.1.0+3653+beb38eb0, ruby-libs 2.6.9-107.module+el8.2.0+14086+86d863af, rubygem-abrt 0.3.0-4.module+el8.1.0+3653+beb38eb0, rubygem-bson 4.5.0-1.module+el8.1.0+3653+beb38eb0, rubygem-mongo 2.8.0-1.module+el8.1.0+3653+beb38eb0, +17 more
    fixed: vendor fix RHSA-2022:0582
  • Red Hat Enterprise Linux AppStream EUS (v.8.4) ruby 2.6.9-108.module+el8.4.0+14070+b3717926, rubygem-pg 1.1.4-1.module+el8.1.0+3653+beb38eb0, ruby-libs 2.6.9-108.module+el8.4.0+14070+b3717926, rubygem-abrt 0.3.0-4.module+el8.1.0+3653+beb38eb0, rubygem-bson 4.5.0-1.module+el8.1.0+3653+beb38eb0, rubygem-mongo 2.8.0-1.module+el8.1.0+3653+beb38eb0, +17 more
    fixed: vendor fix RHSA-2022:0544
  • Red Hat Software Collections for Red Hat Enterprise Linux Server (v. 7) rh-ruby27-ruby 2.7.4-130.el7, rh-ruby30-ruby 3.0.2-148.el7, rh-ruby27-rubygems 3.1.6-130.el7, rh-ruby27-ruby-libs 2.7.4-130.el7, rh-ruby30-ruby-libs 3.0.2-148.el7, rh-ruby30-rubygems 3.2.22-148.el7, +31 more Red Hat Software Collections for Red Hat Enterprise Linux Server EUS (v. 7.7) rh-ruby27-ruby 2.7.4-130.el7, rh-ruby30-ruby 3.0.2-148.el7, rh-ruby27-rubygems 3.1.6-130.el7, rh-ruby27-ruby-libs 2.7.4-130.el7, rh-ruby30-ruby-libs 3.0.2-148.el7, rh-ruby30-rubygems 3.2.22-148.el7, +31 more Red Hat Software Collections for Red Hat Enterprise Linux Workstation (v. 7) rh-ruby27-ruby 2.7.4-130.el7, rh-ruby30-ruby 3.0.2-148.el7, rh-ruby27-rubygems 3.1.6-130.el7, rh-ruby27-ruby-libs 2.7.4-130.el7, rh-ruby30-ruby-libs 3.0.2-148.el7, rh-ruby30-rubygems 3.2.22-148.el7, +31 more
    fixed: vendor fix RHSA-2021:3559
  • Red Hat Software Collections for RHEL Workstation(v. 7) rh-ruby26-ruby 2.6.9-120.el7, rh-ruby26-ruby-libs 2.6.9-120.el7, rh-ruby26-rubygems 3.0.3.1-120.el7, rh-ruby26-rubygem-irb 1.0.0-120.el7, rh-ruby26-rubygem-json 2.1.0-120.el7, rh-ruby26-rubygem-psych 3.1.0-120.el7, +12 more Red Hat Software Collections for RHEL(v. 7) rh-ruby26-ruby 2.6.9-120.el7, rh-ruby26-ruby-libs 2.6.9-120.el7, rh-ruby26-rubygems 3.0.3.1-120.el7, rh-ruby26-rubygem-irb 1.0.0-120.el7, rh-ruby26-rubygem-json 2.1.0-120.el7, rh-ruby26-rubygem-psych 3.1.0-120.el7, +12 more
    fixed: vendor fix RHSA-2022:0708
show 1 more
  • Red Hat Enterprise Linux 6 ruby, ruby-ri, ruby-irb, ruby-libs, ruby-rdoc, ruby-tcltk Red Hat Enterprise Linux 9 ruby, rubygems, ruby-libs, rubygem-irb, rubygem-rbs, rubygem-rss, +13 more
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
total
Assessed
2 y ago

Exploit prediction

1.48% chance of exploitation in the next 30 days, higher than 74% of all scored CVEs (FIRST EPSS, 2026-11-08).

CVSS scores

assigned by version score vector
CISA ADP 3.1 7.0 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
GitHub 3.1 7.0 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD 3.1 7.0 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
CNA 3.1 7.0 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD 2.0 4.4 AV:L/AC:M/Au:N/C:P/I:P/A:P

Affected packages

ecosystem package affected fixed in
rubygems rdoc
>=3.11, <6.1.2.1
>=6.2.0, <6.2.1.1
>=6.3.0, <6.3.1
6.1.2.1
6.2.1.1
6.3.1

Classification

Weakness
  • CWE-78 Improper Neutralization of Special Elements used in an OS Command
  • CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
  • CWE-77 Improper Neutralization of Special Elements used in a Command

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.

CPEs and fixed versions use Anchore's correction of NVD's data: Improved version ranges and CPE configurations.