CVE-2021-22881: Actionpack Actionpack Open Redirect Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-8877-prq4-9xfw
CVSS 6.1
CWE-601
Published
Advisory Summary

CVE-2021-22881 is a MODERATE (CVSS 6.1) actionpack open redirect vulnerability vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Actionpack libraries in the RubyGems ecosystem. The issue involves actionpack open redirect vulnerability. Remediation is available by upgrading affected packages to version 6.0.3.5, 6.1.2.1.

CVE-2021-22881 at a Glance

CVE Identifier CVE-2021-22881
GHSA Identifier GHSA-8877-prq4-9xfw
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Actionpack
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2021-22881

To remediate this vulnerability, upgrade all affected Actionpack dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

actionpack fixed: 6.0.3.5
Upgrade actionpack to 6.0.3.5
actionpack fixed: 6.1.2.1
Upgrade actionpack to 6.1.2.1
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 actionpack

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-22881, inspect your project dependencies for Actionpack:

inspect dependencies for actionpack

Analyze the terminal output to locate any version of Actionpack in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.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-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Actionpack, 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

The Host Authorization middleware in Action Pack before 6.1.2.1, 6.0.3.5 suffers from an open redirect vulnerability. Specially crafted `Host` headers in combination with certain "allowed host" formats can cause the Host Authorization middleware in Action Pack to redirect users to a malicious website.

CVE-2021-22881 Affected Actionpack Versions

2 component(s)
Fixed Versions:
6.0.3.56.1.2.1
Product / Package Ecosystem Affected Versions Fixed Version
actionpack
RubyGems
≥ 6.0.0
< 6.0.3.5
6.0.3.5
actionpack
RubyGems
≥ 6.1.0
< 6.1.2.1
6.1.2.1

References

NVD — CVE-2021-22881 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-22881
Security Fix Commit FIX COMMIT
https://github.com/rails/rails/commit/b5de7b3a4787d8a55aaad39f477c16e3af65e444
hackerone.com/reports/1047447 WEB
https://hackerone.com/reports/1047447
benjamin-bouchet.com/cve-2021-22881-fail... WEB
https://benjamin-bouchet.com/cve-2021-22881-faille-de-securite-dans-le-middleware-hostauthorization
discuss.rubyonrails.org/t/cve-2021-22881-po... WEB
https://discuss.rubyonrails.org/t/cve-2021-22881-possible-open-redirect-in-host-authorization-middleware/77130
Actionpack Source Repository REPOSITORY
https://github.com/rails/rails
Actionpack Source Repository REPOSITORY
https://github.com/rails/rails/blob/v6.1.2.1/actionpack/CHANGELOG.md
Actionpack Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/actionpack/CVE-2021-22881.yml
Actionpack Security Information SECURITY
https://groups.google.com/g/rubyonrails-security/c/zN_3qA26l6E
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XQ3NS4IBYE2I3MVMGAHFZBZBIZGHXHT3
rubygems.org/gems/actionpack WEB
https://rubygems.org/gems/actionpack
Actionpack Security Information SECURITY
http://www.openwall.com/lists/oss-security/2021/05/05/2
Actionpack Security Information SECURITY
http://www.openwall.com/lists/oss-security/2021/08/20/1
Actionpack Security Information SECURITY
http://www.openwall.com/lists/oss-security/2021/12/14/5

Frequently Asked Questions

What is CVE-2021-22881?
CVE-2021-22881 is a security vulnerability in Actionpack involving Actionpack Open Redirect Vulnerability under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Actionpack versions are affected?
Affected versions include releases prior to 6.0.3.5, 6.1.2.1 across affected packages: actionpack.
What version fixes CVE-2021-22881?
Upgrading to 6.0.3.5, 6.1.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is actionpack affected?
Yes, actionpack is affected in releases prior to 6.0.3.5, 6.1.2.1. Upgrade your dependency to 6.0.3.5, 6.1.2.1 or later.
What is the CVSS score of CVE-2021-22881?
CVE-2021-22881 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-22881?
CVE-2021-22881 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check RubyGems dependencies for CVE-2021-22881?
Run the dependency tree command: 'inspect dependencies for actionpack'. 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-8877-prq4-9xfw",
  "modified" : "2023-07-03T22:06:02Z",
  "published" : "2021-03-02T03:44:17Z",
  "aliases" : [ "CVE-2021-22881" ],
  "summary" : "Actionpack Open Redirect Vulnerability ",
  "details" : "The Host Authorization middleware in Action Pack before 6.1.2.1, 6.0.3.5 suffers from an open redirect vulnerability. Specially crafted `Host` headers in combination with certain \"allowed host\" formats can cause the Host Authorization middleware in Action Pack to redirect users to a malicious website. ",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "actionpack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.3.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.3.4"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "actionpack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.1.0"
      }, {
        "fixed" : "6.1.2.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.1.2.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22881"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rails/rails/commit/b5de7b3a4787d8a55aaad39f477c16e3af65e444"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/1047447"
  }, {
    "type" : "WEB",
    "url" : "https://benjamin-bouchet.com/cve-2021-22881-faille-de-securite-dans-le-middleware-hostauthorization"
  }, {
    "type" : "WEB",
    "url" : "https://discuss.rubyonrails.org/t/cve-2021-22881-possible-open-redirect-in-host-authorization-middleware/77130"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rails/rails"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rails/rails/blob/v6.1.2.1/actionpack/CHANGELOG.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/actionpack/CVE-2021-22881.yml"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/rubyonrails-security/c/zN_3qA26l6E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XQ3NS4IBYE2I3MVMGAHFZBZBIZGHXHT3"
  }, {
    "type" : "WEB",
    "url" : "https://rubygems.org/gems/actionpack"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/05/05/2"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/08/20/1"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/12/14/5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-02T03:44:04Z",
    "nvd_published_at" : "2021-02-11T18:15:00Z"
  }
}