CVE-2021-41816
JSON

9.8critical

Buffer overrun in CGI.escape_html

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
5.26% (higher than 92% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-5cqm-crxm-6qpv

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.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
cgi (RubyGems)from 0.3.0 before 0.3.1, from 0.2.0 before 0.2.1, before 0.1.0.1GitHub Advisory Database
ruby-lang cgibefore 0.3.1, up to 0.2.0, up to 0.1.0NVD
fedoraproject fedora34, 35NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

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.

GitHub Advisory Database

A buffer overrun vulnerability was discovered in CGI.escape_html. This can lead to a buffer overflow when a user passes a very large string (> 700 MB) to CGI.escape_html on a platform where long type takes 4 bytes, typically, Windows.

NVD (es)

El archivo CGI.escape_html en Ruby versiones anteriores a 2.7.5 y 3.x versiones anteriores a 3.0.3, presenta un desbordamiento de enteros y un desbordamiento de búfer resultante por medio de una cadena larga en plataformas (como Windows) donde size_t y long tienen diferentes números de bytes. Esto también afecta a CGI gem versiones anteriores a 0.3.1 para Ruby

References

https://hackerone.com/reports/1328463permissions-required, third-party-advisory, web
https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816/exploit, vendor-advisory
https://security-tracker.debian.org/tracker/CVE-2021-41816third-party-advisory, web
https://security.netapp.com/advisory/ntap-20220303-0006/third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN/vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF/vendor-advisory
https://security.gentoo.org/glsa/202401-27vendor-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2021-41816advisory
https://github.com/ruby/cgi/commit/959ccf0b6a672bcc64aeaa60c6e1f9e728f1e87fweb
https://github.com/ruby/cgi/commit/ad079c1cb5f58eba1ffac46da79995fcf94a3a6eweb
https://github.com/ruby/cgi/commit/c6a37a671b556eb06140ea89cc465136b24207a6web
https://github.com/ruby/cgi/commit/c728632c1c09d46cfd4ecbff9caaa3651dd1002aweb

Sources

SourceRecordLicence
CVE ListCVE-2021-41816 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-5cqm-crxm-6qpv changed 2026-08-13CC-BY-4.0
NVDCVE-2021-41816 changed 2026-06-17Public domain