What’s Vulnerable › Vulnerabilities
CVE-2021-41816
- Severity: critical (CVSS 9.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 4.9% probability of exploitation in the next 30 days
- Public exploit or detection template: yes
- Published: 2022-02-06 · updated 2026-06-17
- Weakness: CWE-190
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 products
- Fedoraproject Fedora: 34, 35
- ruby-lang CGI: before 0.3.1; through 0.2.0; through 0.1.0 — fixed in 0.3.1
How to fix
Upgrade to a fixed version: ruby-lang CGI 0.3.1. Check the vendor advisory for mitigations.
References
- https://hackerone.com/reports/1328463
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF/
- https://security-tracker.debian.org/tracker/CVE-2021-41816
- https://security.gentoo.org/glsa/202401-27
- https://security.netapp.com/advisory/ntap-20220303-0006/
- https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816/
- https://hackerone.com/reports/1328463
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF/
- https://security-tracker.debian.org/tracker/CVE-2021-41816
- https://security.gentoo.org/glsa/202401-27
Get alerted when CVE-2021-41816 or the next vulnerability affects your stack