cve.bz

CVE-2021-41816 Year 2038 problem, Y2K38, Y2038, Epochalypse

9.8 criticalExploit referenceEPSS 4.9%Fix available

Critical (9.8). EPSS 4.9% estimated probability of exploitation activity in the next 30 days. Fixed in cgi 0.1.0.1, 0.2.1, 0.3.1.

On this page
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.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
4.9% (unchanged from 4.9% a week ago; 4.9% 30 days ago) estimated probability of exploitation activity in the next 30 days; 92nd percentile. Scored 2026-11-21. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-190 Integer Overflow or Wraparound (Year 2038 problem, Y2K38, Y2038, Epochalypse)
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-41816 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-41816?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-41816?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-41816 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
ruby-lang:cgibefore 0.3.1
ruby-lang:cgithrough 0.2.0
ruby-lang:cgithrough 0.1.0
fedoraproject:fedora34
fedoraproject:fedora35

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-5cqm-crxm-6qpvRubyGemscgi>=0.3.0 <0.3.10.3.1
GHSA-5cqm-crxm-6qpvRubyGemscgi>=0.2.0 <0.2.10.2.1
GHSA-5cqm-crxm-6qpvRubyGemscgi<0.1.0.10.1.0.1

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11ruby2.72.7.4-1+deb11u1DEBIAN-CVE-2021-41816 DSA-5067-1
Ubuntu18.04:LTSruby2.52.5.1-1ubuntu1.11USN-5235-1
Ubuntu20.04:LTSruby2.72.7.0-5ubuntu1.6UBUNTU-CVE-2021-41816 USN-5235-1
Ubuntu22.04:LTSruby3.03.0.2-7ubuntu2UBUNTU-CVE-2021-41816
UbuntuPro:16.04:LTSruby2.32.3.1-2~ubuntu16.04.16+esm2USN-5235-1
Red Hatrhel_software_collections:3::el7rh-ruby27-ruby, rh-ruby27-ruby-doc, rh-ruby27-ruby-libs and 2 more0:2.7.6-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-bigdecimal0:2.0.0-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-bundler0:2.2.24-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-did_you_mean0:1.4.0-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-io-console0:0.5.6-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-irb0:1.2.6-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-json0:2.3.0-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-minitest0:5.13.0-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-net-telnet0:0.2.0-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-openssl0:2.1.3-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-power_assert0:1.1.7-131.el7RHSA-2022:6856
Red Hatrhel_software_collections:3::el7rh-ruby27-rubygem-psych0:3.1.0-131.el7RHSA-2022:6856
22 more for Red Hat in the JSON and on Red Hat's page.
openSUSETumbleweedruby2.72.7.5-1.1openSUSE-SU-2024:11657-1
openSUSETumbleweedruby3.03.0.3-1.1openSUSE-SU-2024:11658-1
openSUSETumbleweedruby3.13.1.0-1.1openSUSE-SU-2024:11786-1
openSUSETumbleweedruby3.23.2.1-1.1openSUSE-SU-2024:12712-1
openSUSETumbleweedruby3.33.3.0-1.2openSUSE-SU-2024:13623-1
openSUSETumbleweedruby3.43.4.1-1.1openSUSE-SU-2025:14621-1
openSUSETumbleweedruby4.04.0.0~preview2-1.1openSUSE-SU-2025:15819-1
Alpinev3.12, v3.13, v3.14ruby2.7.5-r0ALPINE-CVE-2021-41816
Alpinev3.15, v3.16, v3.17 and 7 moreruby3.0.3-r0ALPINE-CVE-2021-41816

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; the Alpine secdb, CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · openSUSE · Alpine.

Red Hat

Red Hat rates this Moderate.

ProductPackageStateAdvisory
Red Hat Software Collections for Red Hat Enterprise Linux 7rh-ruby30-ruby-0:3.0.4-149.el7Fixed 2022-10-11RHSA-2022:6855
Red Hat Software Collections for Red Hat Enterprise Linux 7rh-ruby27-ruby-0:2.7.6-131.el7Fixed 2022-10-11RHSA-2022:6856
Red Hat Enterprise Linux 6rubyNot affected
Red Hat Enterprise Linux 7rubyNot affected
Red Hat Enterprise Linux 8ruby:2.5/rubyNot affected
Red Hat Enterprise Linux 8ruby:2.6/rubyNot affected
Red Hat Enterprise Linux 8ruby:2.7/rubyNot affected
Red Hat Enterprise Linux 8ruby:3.0/rubyNot affected
Red Hat Enterprise Linux 9rubyNot affected
Red Hat Software Collectionsrh-ruby26-rubyNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-41816.

Attack patterns (CAPEC)

  • CAPEC-92 Forced Integer Overflow Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON