CVE-2021-41816: Buffer Overflow
A buffer overrun vulnerability was discovered in CGI.escapehtml. This can lead to a buffer overflow when a user passes a very large string (> 700 MB) to CGI.escapehtml on a platform where long type takes 4 bytes, typically, Windows.
Other sources
A flaw was found in the ruby. This issue occurs due to improper bounds checking by a buffer overrun in CGI.escapehtml. By sending an overly long string using the sizet parameter, a remote attacker could overflow a buffer and execute arbitrary code on the system.
A security vulnerability that causes buffer overflow when you pass a very large string (> 700 MB) to CGI.escapehtml on a platform where long type takes 4 bytes, typically, Windows.
Reference: https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escapehtml-cve-2021-41816/
— Red Hat
CGI.escapehtml 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 sizet and long have different numbers of bytes. This also affects the CGI gem before 0.3.1 for Ruby.
Affected Software
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2021-41816?
CVE-2021-41816 is a buffer overrun vulnerability in CGI.escape_html in Ruby before 2.7.5 and 3.x before 3.0.3.
How severe is CVE-2021-41816?
CVE-2021-41816 has a severity rating of 9.8, which is considered critical.
Which software versions are affected by CVE-2021-41816?
CGI.escape_html in Ruby versions before 2.7.5 and 3.x before 3.0.3 are affected.
How can I fix CVE-2021-41816?
To fix CVE-2021-41816, upgrade to Ruby version 2.7.5 or 3.0.3, or apply the appropriate remedy provided by the software vendor.
Where can I find more information about CVE-2021-41816?
You can find more information about CVE-2021-41816 in the references section of the vulnerability report.