{"id":"CVE-2021-41816","aliases":["GHSA-5cqm-crxm-6qpv"],"url":"https://o3.security/vulnerability/CVE-2021-41816","summary":"Buffer overrun in CGI.escape_html","details":"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.","published":"2022-02-06T21:15:07.887Z","modified":"2026-09-16T03:45:06.515289600Z","cvss":{"score":9.8,"severity":"CRITICAL","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"},"epss":{"score":0.04766,"percentile":0.91459,"asOf":"2026-09-17"},"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"RubyGems","name":"cgi","fixedVersion":"0.3.1"},{"ecosystem":"RubyGems","name":"cgi","fixedVersion":"0.2.1"},{"ecosystem":"RubyGems","name":"cgi","fixedVersion":"0.1.0.1"}],"fix":{"url":"https://github.com/ruby/cgi/commit/959ccf0b6a672bcc64aeaa60c6e1f9e728f1e87f","label":"ruby/cgi@959ccf0"},"references":[{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN/"},{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF/"},{"type":"ADVISORY","url":"https://security-tracker.debian.org/tracker/CVE-2021-41816"},{"type":"ADVISORY","url":"https://security.gentoo.org/glsa/202401-27"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20220303-0006/"},{"type":"REPORT","url":"https://hackerone.com/reports/1328463"},{"type":"EVIDENCE","url":"https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816/"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41816"},{"type":"WEB","url":"https://github.com/ruby/cgi/commit/959ccf0b6a672bcc64aeaa60c6e1f9e728f1e87f"},{"type":"WEB","url":"https://github.com/ruby/cgi/commit/ad079c1cb5f58eba1ffac46da79995fcf94a3a6e"},{"type":"WEB","url":"https://github.com/ruby/cgi/commit/c6a37a671b556eb06140ea89cc465136b24207a6"},{"type":"WEB","url":"https://github.com/ruby/cgi/commit/c728632c1c09d46cfd4ecbff9caaa3651dd1002a"},{"type":"WEB","url":"https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816"},{"type":"WEB","url":"https://security.netapp.com/advisory/ntap-20220303-0006"},{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF"},{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN"},{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF"},{"type":"WEB","url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN"},{"type":"WEB","url":"https://groups.google.com/g/ruby-security-ann/c/4MQ568ZG47c"},{"type":"WEB","url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-41816.yml"},{"type":"PACKAGE","url":"https://github.com/ruby/cgi"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-09-16T03:45:06.515289600Z"}}