Skip to content
OpenAdvisories
Critical · 9.8 CVE-2021-41816 EUVD-2021-2447GHSA-5cqm-crxm-6qpv

Buffer overrun in CGI.escape_html

Published Feb 6, 2022 · Updated Aug 4, 2024 · Assigned by mitre

Description

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.

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 11 ruby2.7 2.7.4-1+deb11u1 DSA-5067-1
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS ruby3.0 3.0.2-7ubuntu2 —
Ubuntu 20.04 LTS ruby2.7 2.7.0-5ubuntu1.6 USN-5235-1
Ubuntu 18.04 LTS ruby2.5 2.5.1-1ubuntu1.11 USN-5235-1
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 16.04 LTS ruby2.3 2.3.1-2~ubuntu16.04.16+esm2 USN-5235-1
ReleasePackageFixed inAdvisory
RHEL 3 rh-ruby27-ruby +3 2.7.6-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-bigdecimal 2.0.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-bundler 2.2.24-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-did_you_mean 1.4.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-io-console 0.5.6-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-irb 1.2.6-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-json 2.3.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-minitest 5.13.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-net-telnet 0.2.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-openssl 2.1.3-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-power_assert 1.1.7-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-psych 3.1.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-racc 1.4.16-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-rake 13.0.1-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-rdoc 6.2.1.1-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-test-unit 3.3.4-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygem-xmlrpc 0.3.0-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby27-rubygems +1 3.1.6-131.el7 RHSA-2022:6856
RHEL 3 rh-ruby30-ruby +4 3.0.4-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-bigdecimal 3.0.0-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-bundler 2.2.33-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-io-console 0.5.7-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-irb 1.3.5-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-json 2.5.1-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-minitest 5.14.2-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-power_assert 1.2.0-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-psych 3.3.2-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-rake 13.0.3-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-rbs 1.4.0-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-rexml 3.2.5-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-rss 0.2.9-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-test-unit 3.3.7-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygem-typeprof 0.15.2-149.el7 RHSA-2022:6855
RHEL 3 rh-ruby30-rubygems +1 3.2.33-149.el7 RHSA-2022:6855
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed ruby2.7 2.7.5-1.1 openSUSE-SU-2024:11657-1
openSUSE Tumbleweed ruby3.0 3.0.3-1.1 openSUSE-SU-2024:11658-1
openSUSE Tumbleweed ruby3.1 3.1.0-1.1 openSUSE-SU-2024:11786-1
openSUSE Tumbleweed ruby3.2 3.2.1-1.1 openSUSE-SU-2024:12712-1
openSUSE Tumbleweed ruby3.3 3.3.0-1.2 openSUSE-SU-2024:13623-1
openSUSE Tumbleweed ruby3.4 3.4.1-1.1 openSUSE-SU-2025:14621-1
openSUSE Tumbleweed ruby4.0 4.0.0~preview2-1.1 openSUSE-SU-2025:15819-1
ReleasePackageFixed inAdvisory
Alpine v3.24 ruby 3.0.3-r0 —
Alpine v3.23 ruby 3.0.3-r0 —
Alpine v3.22 ruby 3.0.3-r0 —
Alpine v3.21 ruby 3.0.3-r0 —
Alpine v3.20 ruby 3.0.3-r0 —
Show 8 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 ruby 3.0.3-r0 —
Alpine v3.18 ruby 3.0.3-r0 —
Alpine v3.17 ruby 3.0.3-r0 —
Alpine v3.16 ruby 3.0.3-r0 —
Alpine v3.15 ruby 3.0.3-r0 —
Alpine v3.14 ruby 2.7.5-r0 —
Alpine v3.13 ruby 2.7.5-r0 —
Alpine v3.12 ruby 2.7.5-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
RubyGems cgi >= 0.3.0, < 0.3.1 0.3.1 GHSA-5cqm-crxm-6qpv
RubyGems cgi >= 0.2.0, < 0.2.1 0.2.1 GHSA-5cqm-crxm-6qpv
RubyGems cgi < 0.1.0.1 0.1.0.1 GHSA-5cqm-crxm-6qpv

Advisories 12

References