CVE-2021-41819 — Cookie Prefix Spoofing in cgi — CVE Details
Cookie Prefix Spoofing in CGI::Cookie.parse
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (3.20%). Schedule for your next planned update.
Does your project use an affected cgi version?
Paste your Gemfile.lock to check it for CVE-2021-41819 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published January 21, 2022 (1771 days ago).
- Last revised January 27, 2025 — 1101 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install cgi -v 0.2.1
gem install cgi -v 0.1.0.1
gem install cgi -v 0.3.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (3)
Affects 1 ecosystem: RubyGems (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-565
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.5 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
References
- https://nvd.nist.gov/vuln/detail/CVE-2021-41819ADVISORY
- https://hackerone.com/reports/910552WEB
- https://github.com/ruby/cgiPACKAGE
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-41819.ymlWEB
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWNWEB
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZFWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWNWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZFWEB
- https://security.gentoo.org/glsa/202401-27WEB
- https://security.netapp.com/advisory/ntap-20220121-0003WEB
- https://www.ruby-lang.org/en/news/2021/11/24/cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819WEB
Frequently Asked Questions
- What is CVE-2021-41819?
- Cookie Prefix Spoofing in CGI::Cookie.parse. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.5/10).
- How do I check if my project is affected by CVE-2021-41819?
- CVE-2021-41819 affects cgi. It has a 3.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-41819 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This places it in the top quartile of EPSS-scored vulnerabilities — 88.9% of tracked vulnerabilities score at or below it, so it is more likely to be exploited than most of the tracked corpus.
Also Known As
Related CVEs
- CVE-2021-41816CRITICAL
Buffer overrun in CGI.escape_html
- CVE-2026-126366HIGH
msgpack-ruby JRuby decoder makes uncapped header-count allocations; a 5-byte message forces multi-GiB OOM
- CVE-2021-33621HIGH
HTTP response splitting in CGI
- CVE-2026-126081HIGH
Action Pack: Possible Strong Parameters Bypass in Parameters#each_key
- CVE-2025-27219MEDIUM
CGI has Denial of Service (DoS) potential in Cookie.parse
- CVE-2025-27220MEDIUM
CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement