Read the docs
TI-2021-18442 Aliases CVE-2021-41816GHSA-5cqm-crxm-6qpv

CGI.escape_html in Ruby before 2.7.5 and 3.x before 3.0.3 has an integer overflow and…

Priority MEDIUM 50CWE-190Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · NVD. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-190 and the CVSS impact.

Summary

CGI.escape_html in Ruby before 2.7.5 and 3.x before 3.0.3 has an integer overflow and resultant buffer overflow via a long string on platforms (such as Windows) where size_t and long have different numbers of bytes. This also affects the CGI gem before 0.3.1 for Ruby.

Why it matters now

EPSS 0.04898 92nd percentileScored 2026-11-07
Public exploit Yes 1 exploit referenceTagged by NVD
Fix Fixed cgi (RubyGems): 0.3.1, 0.2.1, 0.1.0.1Red Hat: 2 advisories

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
——all versions—No fix listedCNA
—cgi (RubyGems)0.3.0 to before 0.3.10.3.1Patch availableGHSA-5cqm-crxm-6qpv
—cgi (RubyGems)0.2.0 to before 0.2.10.2.1Patch availableGHSA-5cqm-crxm-6qpv
—cgi (RubyGems)before 0.1.0.10.1.0.1Patch availableGHSA-5cqm-crxm-6qpv
  • — Vendor— Affected all versions Fixed in — No fix listed CNA
  • cgi (RubyGems) Vendor— Affected 0.3.0 to before 0.3.1 Fixed in 0.3.1 Patch available GHSA-5cqm-crxm-6qpv
  • cgi (RubyGems) Vendor— Affected 0.2.0 to before 0.2.1 Fixed in 0.2.1 Patch available GHSA-5cqm-crxm-6qpv
  • cgi (RubyGems) Vendor— Affected before 0.1.0.1 Fixed in 0.1.0.1 Patch available GHSA-5cqm-crxm-6qpv

CPE configurations NVD · 6

CPEVersionsRoleVendor
cpe:2.3:a:ruby-lang:cgi:*:*:*:*:*:ruby:*:*before 0.3.1; up to 0.2.0Vulnerableruby
cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*3.0.0 to before 3.0.3Running onruby
cpe:2.3:a:ruby-lang:cgi:*:*:*:*:*:ruby:*:*up to 0.1.0Vulnerableruby
cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*2.7.0 to before 2.7.5Running onruby
cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*34VulnerableFedoraproject
cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*35VulnerableFedoraproject
  • cpe:2.3:a:ruby-lang:cgi:*:*:*:*:*:ruby:*:* Versions before 0.3.1; up to 0.2.0 Vulnerable ·ruby
  • cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:* Versions 3.0.0 to before 3.0.3 Running on ·ruby
  • cpe:2.3:a:ruby-lang:cgi:*:*:*:*:*:ruby:*:* Versions up to 0.1.0 Vulnerable ·ruby
  • cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:* Versions 2.7.0 to before 2.7.5 Running on ·ruby
  • cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:* Versions 34 Vulnerable ·Fedoraproject
  • cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject

Remediation

  • Fix · GHSA-5cqm-crxm-6qpv cgi (RubyGems) Fixed in 0.3.1 Advisory →
  • Fix · GHSA-5cqm-crxm-6qpv cgi (RubyGems) Fixed in 0.2.1 Advisory →
  • Fix · GHSA-5cqm-crxm-6qpv cgi (RubyGems) Fixed in 0.1.0.1 Advisory →

Red Hat 2 advisories

  • RHSA-2022:6856 Released 2022-10-11 · Red Hat rating Moderate
    rh-ruby27-ruby security, bug fix, and enhancement update
    • Red Hat Software Collections for RHEL Workstation(v. 7) rh-ruby27-ruby-2.7.6-131.el7, rh-ruby27-ruby-devel-2.7.6-131.el7, rh-ruby27-ruby-doc-2.7.6-131.el7 +19
    • Red Hat Software Collections for RHEL(v. 7) rh-ruby27-ruby-2.7.6-131.el7, rh-ruby27-ruby-devel-2.7.6-131.el7, rh-ruby27-ruby-doc-2.7.6-131.el7 +19
  • RHSA-2022:6855 Released 2022-10-11 · Red Hat rating Moderate
    rh-ruby30-ruby security, bug fix, and enhancement update
    • Red Hat Software Collections for RHEL Workstation(v. 7) rh-ruby30-ruby-3.0.4-149.el7, rh-ruby30-ruby-default-gems-3.0.4-149.el7, rh-ruby30-ruby-devel-3.0.4-149.el7 +18
    • Red Hat Software Collections for RHEL(v. 7) rh-ruby30-ruby-3.0.4-149.el7, rh-ruby30-ruby-default-gems-3.0.4-149.el7, rh-ruby30-ruby-devel-3.0.4-149.el7 +18

Vendor assessments

Red Hat

Red Hat rating: Moderate. Red Hat's page for this CVE →

ProductStatusPlan or fix
Red Hat Software Collections for RHEL Workstation(v. 7)Fixed RHSA-2022:6855, RHSA-2022:6856
Red Hat Software Collections for RHEL(v. 7)Fixed RHSA-2022:6855, RHSA-2022:6856
Not affected: 5 products
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Red Hat Software Collections

Timeline

  1. 2026-10-02 Threatist record created from CVE-2021-41816
  2. 2026-10-03 Alias added: GHSA-5cqm-crxm-6qpv

References

Sources