CVE-2021-22881: Actionpack Open Redirect Vulnerability
6.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.90965%
CWE
Published
3/2/2021
Updated
7/3/2023
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| actionpack | rubygems | >= 6.0.0, <= 6.0.3.4 | 6.0.3.5 |
| actionpack | rubygems | >= 6.1.0, <= 6.1.2.0 | 6.1.2.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper host validation in the HostAuthorization middleware. The commit b5de7b3 shows the fix involved adding strict regex validation (/\A(?<host>[a-z0-9.-]+|[[a-f0-9]*:[a-f0-9.:]+])(:\d+)?\z/i) to the authorized? method. The pre-patch version lacked proper escaping and domain validation, allowing subdomain wildcard matches (via .example.com patterns) to be exploited with crafted Host headers. The test case added in host_authorization_test.rb specifically verifies protection against hostnames with invalid characters like '#', confirming the function's role in the vulnerability.