CVE-2021-41816
ruby: buffer overflow in CGI.escape_html
Overview
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.
Source: OX vulnerability database
Severity
9.8 · CRITICAL
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness: CWE-190
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| RubyGems | cgi | >=0.3.0, <0.3.1>=0.2.0, <0.2.1<0.1.0.1 | 0.3.10.2.10.1.0.1~> 0.1.0.1~> 0.1.1 |
Open a package to see all its vulnerabilities.
Operating systems · 50 fixes
Photon OS 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 4.0 | ruby +1 | 2.7.4-9.ph4 |
Red Hat 1 release · 34 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 7 | rh-ruby30-rubygem-typeprof | 0:0.15.2-149.el7 | RHSA-2022:6855 |
| 7 | rh-ruby27-rubygem-net-telnet | 0:0.2.0-131.el7 | RHSA-2022:6856 |
| 7 | rh-ruby30-rubygem-rss | 0:0.2.9-149.el7 | RHSA-2022:6855 |
| 7 | rh-ruby27-rubygem-xmlrpc | 0:0.3.0-131.el7 | RHSA-2022:6856 |
| 7 | rh-ruby27-rubygem-io-console | 0:0.5.6-131.el7 | RHSA-2022:6856 |
| 7 | rh-ruby30-rubygem-io-console | 0:0.5.7-149.el7 | RHSA-2022:6855 |
28 more rows
alpine 4 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 3.22 | ruby | 3.0.3-r0 |
| 3.23 | ruby | 3.0.3-r0 |
| 3.24 | ruby | 3.0.3-r0 |
| edge | ruby | 3.0.3-r0 |
debian 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 11 | ruby2-7 | 2.7.4-1+deb11u1 |
openSUSE 1 release · 7 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Tumbleweed | libruby2-7-2-7 +5 | 2.7.5-1.1 | openSUSE-SU-2024:11657-1 |
| Tumbleweed | libruby3-0-3-0 +5 | 3.0.3-1.1 | openSUSE-SU-2024:11658-1 |
| Tumbleweed | libruby3-1-3-1 +5 | 3.1.0-1.1 | openSUSE-SU-2024:11786-1 |
| Tumbleweed | libruby3-2-3-2 +5 | 3.2.1-1.1 | openSUSE-SU-2024:12712-1 |
| Tumbleweed | libruby3-3-3-3 +5 | 3.3.0-1.2 | openSUSE-SU-2024:13623-1 |
| Tumbleweed | libruby3-4-3-4 +5 | 3.4.1-1.1 | openSUSE-SU-2025:14621-1 |
1 more row
ubuntu 3 releases · 2 packages
| Release | Package | Fixed in |
|---|---|---|
| 20.04 | ruby2-7 | 2.7.0-5ubuntu1.6 |
| 20.04-ESM | ruby2-7 | 2.7.0-5ubuntu1.6 |
| 22.04 | ruby3-0 | 3.0.2-7ubuntu2 |
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2021-41816
- github.com https://github.com/ruby/cgi
- github.com https://github.com/ruby/cgi/commit/959ccf0b6a672bcc64aeaa60c6e1f9e728f1e87f
- github.com https://github.com/ruby/cgi/commit/ad079c1cb5f58eba1ffac46da79995fcf94a3a6e
- github.com https://github.com/ruby/cgi/commit/c6a37a671b556eb06140ea89cc465136b24207a6
- github.com https://github.com/ruby/cgi/commit/c728632c1c09d46cfd4ecbff9caaa3651dd1002a
- github.com https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-41816.yml
- groups.google.com https://groups.google.com/g/ruby-security-ann/c/4MQ568ZG47c
- hackerone.com https://hackerone.com/reports/1328463
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN
Show all 24 references
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN/
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF/
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN
- lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2021-41816
- security-tracker.debian.org https://security-tracker.debian.org/tracker/CVE-2021-41816
- security.gentoo.org https://security.gentoo.org/glsa/202401-27
- security.netapp.com https://security.netapp.com/advisory/ntap-20220303-0006
- security.netapp.com https://security.netapp.com/advisory/ntap-20220303-0006/
- ubuntu.com https://ubuntu.com/security/notices/USN-5235-1
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2021-41816
- www.ruby-lang.org https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816
- www.ruby-lang.org https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816/
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.