Skip to main content
No exploitation reportedFix available

CVE-2021-41816

No exploitation reported by the sources we read.

  • Published2022-02-06
  • Fixed in0.3.1 · 0.2.1 · 0.1.0.1
  • WeaknessCWE-190

Am I affected?

With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.

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.

Timeline

dates in UTC
  1. 2022-02-0621:15CVE publishedNVD

Versions per branch

NVD · OSV
Ruby-lang cgiversion to verify
BranchAffectedFixed in
0.3< 0.3.10.3.1
0.3≥ 0.3.0, < 0.3.10.3.1
0.2≥ 0.2.0, < 0.2.10.2.1
0.1< 0.1.0.10.1.0.1
0.2≤ 0.2.0no fix published
0.1≤ 0.1.0no fix published
Fedoraproject fedora
BranchAffectedFixed in
34.x= 34no fix published
35.x= 35no fix published

as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.

Distribution builds and vendor advisories

Packages from OSV.dev and products from the vendors' CSAF advisories.

version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.

Packages

  • rh-ruby27-rubyRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:2.7.6-131.el7and 4 other packages
  • rh-ruby27-rubygem-bigdecimalRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:2.0.0-131.el7
  • rh-ruby27-rubygem-bundlerRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:2.2.24-131.el7
  • rh-ruby27-rubygem-did_you_meanRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:1.4.0-131.el7
  • rh-ruby27-rubygem-io-consoleRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:0.5.6-131.el7
  • rh-ruby27-rubygem-irbRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:1.2.6-131.el7
  • rh-ruby27-rubygem-jsonRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:2.3.0-131.el7
  • rh-ruby27-rubygem-minitestRed Hat:rhel_software_collections:3::el7all versions · fixed in 0:5.13.0-131.el7

53 more package ranges on OSV.dev

Vendor advisories

  • CVE-2021-41816 Red Hat Product Security130 products fixed

    ruby: buffer overflow in CGI.escape_html

  • RHSA-2022:6856 Red Hat Product Security68 products fixed

    Red Hat Security Advisory: rh-ruby27-ruby security, bug fix, and enhancement update

  • RHSA-2022:6855 Red Hat Product Security62 products fixed

    Red Hat Security Advisory: rh-ruby30-ruby security, bug fix, and enhancement update

Full record on NVD

Fix

  1. Update Ruby-lang cgi to 0.3.1 · 0.2.1 · 0.1.0.1
  2. Vendor fix Red Hat Product Security RHSA-2022:6856 · 68 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://access.redhat.com/articles/11258

Advisories and patches

Detection

Nuclei template
none so far
ProjectDiscovery
Exploit-DB
no entry
Exploit-DB
Proof of concept
Metasploit modules
none listed
Metasploit Framework

Sources

  • NVDCVSS 3.19.8read 2026-10-23
  • NVDCVSS 2.07.5read 2026-10-23
  • NVDweakness (CWE)CWE-190read 2026-10-23
  • FIRST EPSSEPSS score4.9 %2026-11-08
  • OSVaffected packages—
  • GitHub AdvisoriesadvisoryCRITICAL2021-12-14

Identifiers

Technical details

CVSS v3 Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Published
2022-02-06
Last Modified
2026-06-17
NVD status
Modified
GitHub Advisory
GHSA-5cqm-crxm-6qpv

Frequently asked questions

What is CVE-2021-41816?

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.

Is CVE-2021-41816 actively exploited?

Active exploitation of CVE-2021-41816 has not been confirmed. Its EPSS score was 4.9% on 2026-11-08, the estimated probability of exploitation in the next 30 days.

What is the CVSS score for CVE-2021-41816?

CVE-2021-41816 has a CVSS v3 base score of 9.8 (CRITICAL severity), with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.

Running cgi? Hear about its next vulnerability

Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».

No credit card required · No monthly cap on website lookups · 250 API requests/month

Sources for this record