CVE-2021-41819: Cookie Prefix Spoofing in CGI :Cookie.parse Vulnerability
HIGHCVE-2021-41819 is a HIGH (CVSS 7.5) :cookie.parse vulnerability (CWE-565: Reliance on Cookies without Validation and Integrity Checking) affecting Cookie Prefix Spoofing in CGI libraries in the RubyGems ecosystem. The issue involves :cookie.parse. Remediation is available by upgrading affected packages to version 0.3.1, 0.2.1, 0.1.0.1.
CVE-2021-41819 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2021-41819
To remediate this vulnerability, upgrade all affected Cookie Prefix Spoofing in CGI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade cgi to 0.3.1
Upgrade cgi to 0.2.1
Upgrade cgi to 0.1.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for cgi
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-41819, inspect your project dependencies for Cookie Prefix Spoofing in CGI:
inspect dependencies for cgi
Analyze the terminal output to locate any version of Cookie Prefix Spoofing in CGI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-565: Reliance on Cookies without Validation and Integrity Checking, where the product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user. In Cookie Prefix Spoofing in CGI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-41819 Affected Cookie Prefix Spoofing in CGI Versions
3 component(s)References
Frequently Asked Questions
What is CVE-2021-41819?
Which Cookie Prefix Spoofing in CGI versions are affected?
What version fixes CVE-2021-41819?
Is cgi affected?
What is the CVSS score of CVE-2021-41819?
What CWE is associated with CVE-2021-41819?
How can I check RubyGems dependencies for CVE-2021-41819?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4vf4-qmvg-mh7h",
"modified" : "2023-08-29T16:46:42Z",
"published" : "2022-01-21T23:22:17Z",
"aliases" : [ "CVE-2021-41819" ],
"summary" : "Cookie Prefix Spoofing in CGI::Cookie.parse",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.3.0"
}, {
"fixed" : "0.3.1"
} ]
} ],
"versions" : [ "0.3.0" ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.2.0"
}, {
"fixed" : "0.2.1"
} ]
} ],
"versions" : [ "0.2.0" ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.1.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41819"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/910552"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ruby/cgi"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-41819.yml"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IUXQCH6FRKANCVZO2Q7D2SQX33FP3KWN"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTOJGS5IEFDK3UOO7IY4OTTFGHGLSWZF"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/202401-27"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20220121-0003"
}, {
"type" : "WEB",
"url" : "https://www.ruby-lang.org/en/news/2021/11/24/cookie-prefix-spoofing-in-cgi-cookie-parse-cve-2021-41819"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-565" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-13T18:53:26Z",
"nvd_published_at" : "2022-01-01T06:15:00Z"
}
}