The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-22942

CVE-2021-22942: Rails Open Redirect Vulnerability

CVE-2021-22942 is an open redirect flaw in Ruby on Rails Action Pack's Host Authorization middleware that allows attackers to redirect users to malicious websites. This article covers technical details, affected versions, and mitigation.

Published: February 25, 2026

CVE-2021-22942 Overview

CVE-2021-22942 is an open redirect vulnerability affecting the Host Authorization middleware in Ruby on Rails Action Pack. This security flaw exists in Action Pack versions 6.0.0 and later, allowing attackers to craft malicious URLs that redirect users to arbitrary external websites. Open redirect vulnerabilities are particularly dangerous in phishing campaigns, as they abuse the trust users place in legitimate domains.

Critical Impact

Attackers can exploit this vulnerability to redirect users from trusted Ruby on Rails applications to malicious websites, potentially leading to credential theft, malware distribution, or social engineering attacks.

Affected Products

  • Ruby on Rails 6.0.0 and later versions (prior to 6.0.4.1)
  • Ruby on Rails 6.1.x versions (prior to 6.1.4.1)
  • Action Pack component in affected Rails versions

Discovery Timeline

  • 2021-08-19 - Ruby on Rails releases security patches 6.0.4.1 and 6.1.4.1
  • 2021-10-18 - CVE-2021-22942 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-22942

Vulnerability Analysis

The vulnerability resides in the Host Authorization middleware, a security feature introduced in Rails 6.0 designed to protect against DNS rebinding attacks. The middleware validates incoming request hosts against a configured allowlist. However, a flaw in the validation logic allows attackers to bypass this protection and redirect users to external domains.

When a request fails host authorization, the middleware generates a response that can be manipulated to redirect users. The root cause is improper handling of certain URL patterns during the authorization failure response, which attackers can exploit to redirect users to attacker-controlled websites.

Root Cause

The vulnerability stems from insufficient validation in the Host Authorization middleware's redirect handling logic. When processing requests with invalid hosts, the middleware fails to properly sanitize or validate the redirect destination URL, allowing external URLs to be used as redirect targets. This is classified as CWE-601 (URL Redirection to Untrusted Site), commonly known as an open redirect vulnerability.

Attack Vector

The attack vector is network-based, requiring user interaction where a victim must click a malicious link. Attackers craft URLs that appear to point to a legitimate Rails application but include parameters that trigger the vulnerable redirect behavior. Since the initial URL appears trustworthy, users are more likely to click such links, making this vulnerability particularly effective in phishing campaigns.

The attack flow typically involves:

  1. An attacker crafts a URL pointing to a vulnerable Rails application with a specially crafted host or redirect parameter
  2. The victim clicks the seemingly legitimate link, trusting the Rails application's domain
  3. The Host Authorization middleware processes the request and generates a redirect
  4. Due to improper validation, the user is redirected to an attacker-controlled website
  5. The attacker can then harvest credentials, distribute malware, or conduct further social engineering

Detection Methods for CVE-2021-22942

Indicators of Compromise

  • Unusual redirect responses from Rails applications to external domains
  • Access logs showing requests with suspicious host headers or encoded redirect parameters
  • User reports of unexpected redirects when clicking internal application links
  • Network traffic analysis revealing redirects to known malicious domains

Detection Strategies

  • Monitor application access logs for unusual Host header values in requests
  • Implement web application firewall (WAF) rules to detect open redirect patterns
  • Review HTTP response logs for 3xx status codes redirecting to external domains
  • Deploy SIEM rules to correlate redirect activity with known phishing indicators

Monitoring Recommendations

  • Enable detailed logging for the Host Authorization middleware in Rails applications
  • Configure alerts for redirect responses containing external domain URLs
  • Implement user reporting mechanisms for suspicious redirect behavior
  • Conduct periodic security assessments of Rails application redirect functionality

How to Mitigate CVE-2021-22942

Immediate Actions Required

  • Upgrade Ruby on Rails to version 6.0.4.1 or later for Rails 6.0.x installations
  • Upgrade Ruby on Rails to version 6.1.4.1 or later for Rails 6.1.x installations
  • Review and restrict Host Authorization middleware configuration
  • Implement additional input validation for redirect-related parameters

Patch Information

The Ruby on Rails team addressed this vulnerability in security releases 6.0.4.1 and 6.1.4.1, announced on August 19, 2021. Organizations should update their Rails applications to these patched versions or later. For additional details, refer to the Ruby on Rails Release Announcement. Debian users should also review Debian Security Advisory DSA-5372 for distribution-specific guidance.

Workarounds

  • Configure the Host Authorization middleware with an explicit allowlist of trusted hosts using config.hosts
  • Implement a reverse proxy or WAF to validate and filter incoming Host headers
  • Add application-level validation for any redirect destinations before processing
  • Consider disabling the Host Authorization middleware's redirect functionality until patching is possible
bash
# Configuration example - Add to config/environments/production.rb
# Restrict allowed hosts to prevent open redirect exploitation
config.hosts << "yourdomain.com"
config.hosts << /.*\.yourdomain\.com/

# Optionally, configure host authorization to raise exceptions instead of redirecting
config.host_authorization = { exclude: ->(request) { request.path =~ /^\/health/ } }

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeOther

  • Vendor/TechRubyonrails

  • SeverityMEDIUM

  • CVSS Score6.1

  • EPSS Probability0.65%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-601
  • Technical References
  • NetApp Security Advisory NTAP-20240202-0005

  • Debian Security Advisory DSA-5372
  • Vendor Resources
  • OpenWall OSS Security Discussion

  • Ruby on Rails Release Announcement
  • Related CVEs
  • CVE-2024-28103: Rails Action Pack Policy Header Vulnerability

  • CVE-2026-33169: Ruby on Rails Active Support DoS Vulnerability

  • CVE-2026-33170: Ruby on Rails Active Support XSS Vulnerability

  • CVE-2026-33173: Rails Active Storage Auth Bypass Flaw
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English