CVE-2021-33621: Cgi HTTP Response Splitting Vulnerability

HIGH
Advisory Identifier: GHSA-vc47-6rqg-c7f5
CVSS 8.8
CWE-436 CWE-74
Published
Advisory Summary

CVE-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.

CVE-2021-33621 at a Glance

CVE Identifier CVE-2021-33621
GHSA Identifier GHSA-vc47-6rqg-c7f5
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-436: Interpretation Conflict
Affected Product Cgi
Package Ecosystem RubyGems
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

cgi fixed: 0.3.5
Upgrade cgi to 0.3.5
cgi fixed: 0.2.2
Upgrade cgi to 0.2.2
cgi fixed: 0.1.0.2
Upgrade cgi to 0.1.0.2
Verify Direct and Transitive Dependencies

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

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.

CVE-2021-33621 Affected Cgi Versions

3 component(s)
Fixed Versions:
0.3.50.2.20.1.0.2
Product / Package Ecosystem Affected Versions Fixed Version
cgi
RubyGems
≥ 0.3.0
< 0.3.5
0.3.5
cgi
RubyGems
≥ 0.2.0
< 0.2.2
0.2.2
cgi
RubyGems
< 0.1.0.2
0.1.0.2

References

NVD — CVE-2021-33621 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-33621
hackerone.com/reports/1204695 WEB
https://hackerone.com/reports/1204695
Cgi Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/cgi/CVE-2021-33621.yml
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2023/06/msg00012.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2024/09/msg00000.html
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/DQR7LWED6VAPD5ATYOBZIGJQPCUBRJBX
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/THVTYHHEOVLQFCFHWURZYO7PVUPBHRZD
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YACE6ORF2QBXXBK2V2CM36D7TZMEJVAS
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DQR7LWED6VAPD5ATYOBZIGJQPCUBRJBX
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/THVTYHHEOVLQFCFHWURZYO7PVUPBHRZD
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YACE6ORF2QBXXBK2V2CM36D7TZMEJVAS
Cgi Security Information SECURITY
https://security.gentoo.org/glsa/202401-27
Cgi Security Information SECURITY
https://security.netapp.com/advisory/ntap-20221228-0004
www.ruby-lang.org/en/news/2022/11/22/... WEB
https://www.ruby-lang.org/en/news/2022/11/22/http-response-splitting-in-cgi-cve-2021-33621

Frequently Asked Questions

What is CVE-2021-33621?
CVE-2021-33621 is a security vulnerability in Cgi involving HTTP response splitting in CGI under CWE-436: Interpretation Conflict.
Which Cgi versions are affected?
Affected versions include releases prior to 0.3.5, 0.2.2, 0.1.0.2 across affected packages: cgi.
What version fixes CVE-2021-33621?
Upgrading to 0.3.5, 0.2.2, 0.1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cgi affected?
Yes, cgi is affected in releases prior to 0.3.5, 0.2.2, 0.1.0.2. Upgrade your dependency to 0.3.5, 0.2.2, 0.1.0.2 or later.
What is the CVSS score of CVE-2021-33621?
CVE-2021-33621 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-33621?
CVE-2021-33621 is classified under CWE-436: Interpretation Conflict (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.).
How can I check RubyGems dependencies for CVE-2021-33621?
Run the dependency tree command: 'inspect dependencies for cgi'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}