CVE-2021-22903
Ruby vulnerability analysis and mitigation

Overview

The actionpack ruby gem before version 6.1.3.2 contains an open redirect vulnerability (CVE-2021-22903). The vulnerability affects versions >= v6.1.0.rc2 and was discovered in May 2021. The issue lies in the Host Authorization middleware in Action Pack, where specially crafted Host headers combined with certain "allowed host" formats can cause users to be redirected to malicious websites (Ruby Rails Discussion, Openwall).

Technical details

The vulnerability stems from improper string handling in the Host Authorization middleware. Since a specific commit (rails/rails@9bc7ea5), strings in config.hosts that do not have a leading dot are converted to regular expressions without proper escaping. For example, when config.hosts << "sub.example.com" is set, the system incorrectly permits requests with a Host header value of sub-example.com. The vulnerability has been assigned a CVSS v3.1 base score of 6.1 (MEDIUM) with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N (NVD).

Impact

When successfully exploited, this vulnerability allows attackers to redirect users to malicious websites through specially crafted Host headers. This is particularly concerning as it could be used in phishing attacks or other malicious redirect scenarios (Ruby Rails Discussion).

Mitigation and workarounds

The vulnerability has been fixed in version 6.1.3.2. For users unable to upgrade immediately, a workaround is available through a monkey patch that can be placed in an initializer. The patch modifies the sanitize_string method in the ActionDispatch::HostAuthorization::Permissions class to properly escape regular expressions (Ruby Rails Discussion).

Additional resources


SourceThis report was generated using AI

Related Ruby vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-4249-gjr8-jpq3HIGH8.7
  • RubyRuby
  • prosemirror_to_html
NoYesNov 13, 2025
CVE-2025-64501HIGH7.6
  • RubyRuby
  • prosemirror_to_html
NoYesNov 10, 2025
GHSA-vfpf-xmwh-8m65HIGH7.6
  • RubyRuby
  • prosemirror_to_html
NoYesNov 07, 2025
GHSA-52c5-vh7f-26fxHIGH7.6
  • RubyRuby
  • prosemirror_to_html
NoYesNov 06, 2025
CVE-2025-12790HIGH7.4
  • RubyRuby
  • mqtt
NoYesNov 06, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management