CVE-2021-41819: High severity ruby-lang Cgi Ruby vulnerability
A flaw was found in Ruby. RubyGems cgi gem could allow a remote attacker to conduct spoofing attacks caused by the mishandling of security prefixes in cookie names in the CGI::Cookie.parse function. By sending a specially-crafted request, an attacker could perform cookie prefix spoofing attacks.
Other sources
CGI::Cookie.parse in Ruby through 2.6.8 mishandles security prefixes in cookie names. This also affects the CGI gem prior to versions 0.3.1, 0.2.1, 0.1.1, and 0.1.0.1 for Ruby.
— GitHub
CGI::Cookie.parse in Ruby through 2.6.8 mishandles security prefixes in cookie names. This also affects the CGI gem through 0.3.0 for Ruby.
The old versions of CGI::Cookie.parse applied URL decoding to cookie names. An attacker could exploit this vulnerability to spoof security prefixes in cookie names, which may be able to trick a vulnerable application. By this fix, CGI::Cookie.parse no longer decodes cookie names. Note that this is an incompatibility if cookie names that you are using include non-alphanumeric characters that are URL-encoded. This is the same issue of CVE-2020-8184.
Reference: https://www.ruby-lang.org/en/news/2021/11/24/cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819/
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/rh-ruby26-rubyto a version that resolves this vulnerability.Fixed in 0:2.6.9-120.el7 - Upgrade
Upgrade
redhat/rh-ruby30-rubyto a version that resolves this vulnerability.Fixed in 0:3.0.4-149.el7 - Upgrade
Upgrade
redhat/rh-ruby27-rubyto a version that resolves this vulnerability.Fixed in 0:2.7.6-131.el7 - Upgrade
Upgrade
rubygems/cgito a version that resolves this vulnerability.Fixed in 0.1.0.1 - Upgrade
Upgrade
rubygems/cgito a version that resolves this vulnerability.Fixed in 0.2.1 - Upgrade
Upgrade
rubygems/cgito a version that resolves this vulnerability.Fixed in 0.3.1 - Upgrade
Upgrade
redhat/cgito a version that resolves this vulnerability.Fixed in 0.3.1 - Upgrade
Upgrade
redhat/cgito a version that resolves this vulnerability.Fixed in 0.2.1 - Upgrade
Upgrade
redhat/cgito a version that resolves this vulnerability.Fixed in 0.1.1 - Upgrade
Upgrade
redhat/rubyto a version that resolves this vulnerability.Fixed in 3.0.3 - Upgrade
Upgrade
redhat/rubyto a version that resolves this vulnerability.Fixed in 2.7.5 - Upgrade
Upgrade
redhat/rubyto a version that resolves this vulnerability.Fixed in 2.6.9 - Upgrade
Upgrade
RubyGems cgi gemto a version that resolves this vulnerability.Fixed in 0.3.1
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2021-41819?
CVE-2021-41819 is a vulnerability in Ruby that allows remote attackers to conduct cookie prefix spoofing attacks.
How does CVE-2021-41819 affect RubyGems CGI gem?
CVE-2021-41819 affects the CGI gem in RubyGems, specifically the CGI::Cookie.parse function.
What is the severity of CVE-2021-41819?
CVE-2021-41819 has a severity rating of high.
How can an attacker exploit CVE-2021-41819?
An attacker can exploit CVE-2021-41819 by sending a specially-crafted request to perform cookie prefix spoofing attacks.
How can I fix CVE-2021-41819?
To fix CVE-2021-41819, update to the latest version of RubyGems CGI gem that includes the necessary security patches.