Vulnerabilities in pkg:gem/cgi
PACKAGECVE-2021-33621 is a HIGH (CVSS 8.8) http response splitting vulnerability (CWE-436: Interpretation Conflict) affecting Cgi libraries in the RubyGems ecosystem. The issue involves http response splitting in cgi. Remediation is available by upgrading affected packages to version 0.3.5, 0.2.2, 0.1.0.2.
pkg:gem/cgi
Vulnerability advisories affecting package pkg:gem/cgi. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-vc47-6rqg-c7f5 | CVE-2021-33621 | HIGH | HTTP response splitting in CGI |
| GHSA-mhwm-jh88-3gjf | CVE-2025-27220 | MODERATE | CGI has Regular Expression Denial of Service (ReDoS) potential in Util#escapeElement |
| GHSA-gh9q-2xrm-x6qv | CVE-2025-27219 | MODERATE | CGI has Denial of Service (DoS) potential in Cookie.parse |
| GHSA-4vf4-qmvg-mh7h | CVE-2021-41819 | HIGH | Cookie Prefix Spoofing in CGI::Cookie.parse |
| GHSA-5cqm-crxm-6qpv | CVE-2021-41816 | CRITICAL | Buffer overrun in CGI.escape_html |
CVE-2021-33621 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-33621
To remediate this vulnerability, upgrade all affected 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.5
Upgrade cgi to 0.2.2
Upgrade cgi to 0.1.0.2
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-33621, inspect your project dependencies for Cgi:
inspect dependencies for cgi
Analyze the terminal output to locate any version of 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.5), 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-436: Interpretation Conflict, where product a handles inputs or steps differently than product b, which causes a to perform incorrect actions based on its perception of b's state. 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-33621 Affected Cgi Versions
3 component(s)References
Frequently Asked Questions
What is CVE-2021-33621?
Which Cgi versions are affected?
What version fixes CVE-2021-33621?
Is cgi affected?
What is the CVSS score of CVE-2021-33621?
What CWE is associated with CVE-2021-33621?
How can I check RubyGems dependencies for CVE-2021-33621?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vc47-6rqg-c7f5",
"modified" : "2025-11-04T19:37:14Z",
"published" : "2022-11-19T00:30:55Z",
"aliases" : [ "CVE-2021-33621" ],
"summary" : "HTTP response splitting in CGI",
"details" : "Ruby gem cgi.rb prior to versions 0.3.5, 0.2.2 and 0.1.0.2 allow HTTP header injection. If a CGI application using the CGI library inserts untrusted input into the HTTP response header, an attacker can exploit it to insert a newline character to split a header, and inject malicious content to deceive clients. This issue has been patched in versions 0.3.5, 0.2.2 and 0.1.0.2.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.3.0"
}, {
"fixed" : "0.3.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.2.0"
}, {
"fixed" : "0.2.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "cgi"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.1.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-33621"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/1204695"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-33621.yml"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2023/06/msg00012.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/09/msg00000.html"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DQR7LWED6VAPD5ATYOBZIGJQPCUBRJBX"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/THVTYHHEOVLQFCFHWURZYO7PVUPBHRZD"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YACE6ORF2QBXXBK2V2CM36D7TZMEJVAS"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DQR7LWED6VAPD5ATYOBZIGJQPCUBRJBX"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/THVTYHHEOVLQFCFHWURZYO7PVUPBHRZD"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YACE6ORF2QBXXBK2V2CM36D7TZMEJVAS"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/202401-27"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20221228-0004"
}, {
"type" : "WEB",
"url" : "https://www.ruby-lang.org/en/news/2022/11/22/http-response-splitting-in-cgi-cve-2021-33621"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-436", "CWE-74" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-11-24T01:59:37Z",
"nvd_published_at" : "2022-11-18T23:15:00Z"
}
}