CVE-2021-22881 is a medium-severity (CVSS 6.1) Open Redirect vulnerability in actionpack. 2 public exploit references exist, so weaponization risk is real. A fix is available for actionpack — see the affected versions and patch details below.
Actionpack Open Redirect Vulnerability
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-22881 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,987 CVEs with a current EPSS score, this one falls in the 50–90% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
actionpack💎actionpackReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.
Description
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. Impacted applications will have allowed hosts with a leading dot. When an allowed host contains a leading dot, a specially crafted Host header can be used to redirect to a malicious website.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 💎RubyGems | actionpack | ≥ 6.0.0&&< 6.0.3.5 | 6.0.3.5bundle update actionpack --conservative |
| 💎RubyGems | actionpack | ≥ 6.1.0&&< 6.1.2.1 | 6.1.2.1bundle update actionpack --conservative |
Affected Products
fedorafedoraprojectrailsrubyonrailsResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for actionpack, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update actionpack to 6.0.3.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-22881 is resolved across your whole dependency graph.
Workarounds
Stop reflecting attacker-controlled destinations: resolve every redirect target against an allowlist of paths or hosts you own, prefer a server-side key over a full URL in the request, and reject absolute URLs entirely where the flow only ever needs a relative one.
How to detect CVE-2021-22881
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2021-22881 -u https://target- Template
- Ruby on Rails - Open Redirect via Host Header Injection
- Severity
- medium
- Impact
- Attackers can redirect users to malicious sites, potentially leading to phishing or malware distribution.
- Remediation
- Update to version 6.1.2.1, 6.0.3.5 or later versions.
Template by ProjectDiscovery nuclei-templates (theamanrawat), MIT licensed. View the full template. Scan only systems you are authorised to test.
Frequently Asked Questions
Is CVE-2021-22881 in your dependencies?
Find it across RubyGems, including transitive dependencies.