How a Browser Extension Check Led to Uncovering CVE-2021–44528 (Open Redirect)
A Ruby on Rails application using Host Authorization middleware could be tricked by a crafted X-Forwarded-Host header into issuing a 302 redirect to an arbitrary external domain. An attacker could use this to send a logged-in user to a malicious site after login.
Published on medium.com
Bug Bounty Tips
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up describes how a routine look at a target's infrastructure led to reproducing an open redirect in a Ruby on Rails application. The target is a web application with a login portal at https://app.example.com/login. The researcher does not name the program or the organisation behind it.
The underlying issue is CVE-2021-44528, a flaw in Ruby on Rails Action Pack. Rails ships Host Authorization middleware to defend against HTTP Host Header Injection. Under certain "allowed host" configurations, that middleware can be bypassed by supplying a crafted X-Forwarded-Host request header, and the application then issues an HTTP 302 Found redirect to an arbitrary external domain.

Setup
The report lists no accounts, roles or specific Rails version beyond the affected range. The only stated precondition is that the application runs Action Pack >= 6.0.0 with a host configuration that is vulnerable to the bypass. The tools used were:
- The Shodan browser extension, used to view context on the server stack, open ports and known vulnerabilities for the host.
- Burp, used to intercept and modify the login request.
- A browser, to observe the redirect.
Finding it
While browsing the target application, the researcher opened the Shodan browser extension to get quick context on the server stack, open ports and potential known vulnerabilities tied to the host's infrastructure. Among the listed technologies and CVE findings, one entry stood out: CVE-2021-44528.
That CVE is worth acting on because the exploitation primitive is simple and the middleware involved is meant to prevent exactly this class of header abuse. If the target really was running an affected Action Pack version, a single extra header on the login POST was enough to turn the login flow into a redirect to an attacker-chosen domain.
Exploitation
Step 1: Reach the login portal
The researcher navigated to the application login portal:
https://app.example.com/login

This is the normal entry point for the feature under test: the login form that accepts credentials and, on success, sends the user onward.
Step 2: Submit credentials
Credentials were entered and the Login button was clicked. This produces a POST request, which is the request that will be tampered with in the next step.
Step 3: Intercept the POST and add the header
With Burp intercepting, the POST-based login request was held and an X-Forwarded-Host header was added, set to an external domain, attacker.com:
X-Forwarded-Host is the header a reverse proxy uses to tell the backend which hostname the client originally requested. Rails' Host Authorization middleware is supposed to validate the host against the configured allowed hosts; the flaw is that a crafted value here can slip past that check.

Step 4: Forward the request and observe the redirect
Upon forwarding the modified request, the server responded with a redirect directive pointing to the attacker-controlled host attacker.com. The browser followed it, and the target URL ended up on the external domain after login.

So the sequence is: valid login, one injected header, and the user lands on a domain the attacker controls rather than back inside the application.
Root cause
The report attributes the behaviour to CVE-2021-44528 in Action Pack >= 6.0.0. Rails implements Host Authorization middleware to guard against HTTP Host Header Injection, but when combined with specific "allowed host" configurations, a custom X-Forwarded-Host request header can bypass that logic. The result is an HTTP 302 Found redirect to an arbitrary external domain.
In other words, the host check did not strictly parse the forwarded host against absolute host matching rules, so a value the application should have rejected was accepted and used to build the redirect target. Under that configuration the host check did not strictly parse the forwarded host against absolute host matching rules.
Impact
The concrete effect shown is an open redirect: after a successful login, the user is sent to attacker.com. The report does not describe any further consequence, such as token theft or account takeover, and does not state a severity or bounty.
Fix
The report gives two remediation points:
- Upgrade Action Pack / Rails. Update Ruby on Rails to a patched release where host authorization logic strictly parses
X-Forwarded-Hostheaders against absolute host matching rules. - Explicit host validation. Configure host matching regex patterns strictly, so they do not match unexpected subdomains or forwarded origins.
Variants to test
For context on the host itself, the researcher points to the Shodan extension:

What happened, in plain words
A security researcher was looking at a normal website with a login page. While poking around, he used a browser add-on called Shodan to see what software the site's server was running. The add-on listed a known security bug, CVE-2021-44528, that affects a piece of software called Ruby on Rails. He then tested whether the site really had that bug, and it did: by adding one extra line to the login request, he could make the site send a logged-in user to a different website of his choosing. That kind of bug is called an open redirect.
This article walks through the same steps for someone who has never done security testing before. Every tool and term is explained the first time it appears.

The pieces you need to understand first
Before the steps, a few everyday ideas. Think of a website as a restaurant. Your browser is the customer, the web server is the kitchen, and every request you make is an order slip passed to the kitchen.
- HTTP request: the order slip. When you open a page or submit a form, your browser sends a request to the server. The request has a method (a verb such as GET for "give me this page" or POST for "here is my data, please process it"), a URL (which page), headers (extra notes on the slip) and sometimes a body (the data itself, such as a username and password).
- HTTP response: the kitchen's reply. It has a status code, a number that says how it went.
200means "here is your page".302 Foundmeans "not here, go look at this other address instead", and the response includes aLocationheader holding that other address. Your browser follows it automatically, which is why you sometimes land on a different page than the one you typed. - Header: a labelled note attached to a request or response, such as
Host: app.example.com(which site you are asking for) orContent-Type: application/json(what format the body is in). Headers are just text lines of the formName: value. - Host header: the note that tells a server which website the visitor wants. One physical server often hosts many sites, so the server reads this note to decide which one to serve. Because the browser fills it in, attackers long ago learned to tamper with it, which is called HTTP Host Header Injection.
- Reverse proxy: a receptionist standing in front of the kitchen. Visitors talk to the receptionist, and the receptionist passes orders to the kitchen. Because the receptionist is in the middle, it sometimes adds notes to the slip, for example "the customer originally asked for this address". The
X-Forwarded-Hostheader is exactly such a note. - X-Forwarded-Host: a header a proxy adds to tell the backend server which hostname the visitor originally typed. The
X-prefix is a convention for custom, non-standard headers. - Ruby on Rails (Rails): a popular toolkit for building websites, written in the Ruby programming language. Action Pack is the part of Rails that handles incoming requests and outgoing responses, including redirects.
- Middleware: a checkpoint that every request passes through before reaching the application code, like a security guard at the door. Rails ships one called Host Authorization, whose job is to check the Host header against a list of allowed hostnames and reject anything unexpected.
- CVE: "Common Vulnerabilities and Exposures". A public catalogue number given to a known security flaw so everyone can refer to the same bug. CVE-2021-44528 is the number for this Rails flaw.
- Open redirect: a bug where a site takes an address from the request and redirects the visitor there without checking it. It matters because the link starts on a trusted site, which makes a phishing link look legitimate.
- Burp: a tool that sits between your browser and the server, like a postal worker who can open a letter, change it, and then send it on. It lets you pause a request, edit it, and forward it. Burp Suite has a free edition; the report does not say which edition was used.
- Shodan browser extension: an add-on for the Chrome browser that shows information about the server behind the site you are viewing, such as where it is hosted and which known vulnerabilities may apply.
Setup
The report does not name the organisation or bug bounty program behind the target. It also does not give a specific Rails version, only the affected range: Action Pack >= 6.0.0, meaning version 6.0.0 or any later version that has not been patched. The only stated precondition is that the application runs an affected Action Pack with a host configuration that allows the bypass.
Three things were used:
- The Shodan browser extension, to see the server stack, open ports and known vulnerabilities for the host.
- Burp, to intercept and modify the login request.
- A browser, to watch where the redirect ended up.
Finding it
While browsing the target application, the researcher opened the Shodan extension to get quick context on the server stack, open ports and potential known vulnerabilities tied to the host's infrastructure. Among the listed technologies and CVE findings, one entry stood out: CVE-2021-44528.
Why act on that particular entry? Because the bug is simple to test and the defence involved exists precisely to stop this kind of header tampering. If the site really ran an affected Action Pack version, adding one extra header to a normal login request was enough to turn the login flow into a redirect to a domain the attacker chooses.
What CVE-2021-44528 is
In Rails Action Pack versions >= 6.0.0, the framework includes Host Authorization middleware to guard against HTTP Host Header Injection. When combined with certain "allowed host" configurations, however, an attacker who crafts a custom X-Forwarded-Host request header can bypass that check, and the application then sends an HTTP 302 Found redirect to an arbitrary external domain.
In plain words: the guard is supposed to compare the hostname against a list of allowed names. Under some configurations it does not compare strictly enough, so a value it should reject gets accepted and used to build the redirect address.
Exploitation, step by step
Step 1: Reach the login portal
The researcher opened the application's login page:
https://app.example.com/login

This is the ordinary entry point for the feature being tested: the form where a user types credentials and, on success, is sent onward into the application. Starting here matters because the bug shows up in the redirect that follows a successful login, so you need a real login to trigger it.
Step 2: Submit credentials
Credentials were entered and the Login button was clicked. That produces a POST request, the one that will be tampered with next. A POST is used because the browser is sending data (the credentials) to the server, not just asking for a page.
Step 3: Intercept the POST and add the header
With Burp intercepting, the POST-based login request was paused and an X-Forwarded-Host header was added, set to an external domain, attacker.com:
Line by line: X-Forwarded-Host is the header name, the note a proxy would normally add to say which hostname the visitor originally asked for. attacker.com is the value, a domain the researcher controls rather than the real site. The colon separates name from value, and the space after the colon is the usual formatting.
The idea is to make the server believe the visitor arrived via attacker.com. If the host check is too loose, the server accepts that name and later uses it when building the address it redirects to.

Step 4: Forward the request and observe the redirect
After the modified request was forwarded, the server replied with a redirect pointing to the attacker-controlled host attacker.com. The browser followed it, and after login the target URL ended up on the external domain.

So the whole sequence is: a valid login, one injected header, and the user lands on a domain the attacker controls instead of back inside the application.
Root cause
The report attributes the behaviour to CVE-2021-44528 in Action Pack >= 6.0.0. Rails implements Host Authorization middleware to guard against HTTP Host Header Injection, but when combined with specific "allowed host" configurations, a custom X-Forwarded-Host request header can bypass that logic. The result is an HTTP 302 Found redirect to an arbitrary external domain.
Put simply, the host check did not strictly parse the forwarded host against absolute host matching rules, so a value the application should have rejected was accepted and used to build the redirect target. Under that configuration the host check did not strictly parse the forwarded host against absolute host matching rules.
Impact
The concrete effect shown is an open redirect: after a successful login, the user is sent to attacker.com.
Fix
The report gives two remediation points:
- Upgrade Action Pack / Rails. Update Ruby on Rails to a patched release where host authorization logic strictly parses
X-Forwarded-Hostheaders against absolute host matching rules. - Explicit host validation. Configure host matching regex patterns strictly, so they do not match unexpected subdomains or forwarded origins.
Variants to test
For context on the host itself, the researcher points to the Shodan extension:

Glossary
- 302 Found: an HTTP status code meaning "the thing you asked for is elsewhere, go to this other address", with the address given in the
Locationheader. - Action Pack: the part of the Ruby on Rails framework that handles incoming requests and outgoing responses, including redirects.
- Burp: a tool that sits between browser and server so you can pause, inspect and edit requests before they are sent.
- CVE: Common Vulnerabilities and Exposures, a public catalogue number for a known security flaw.
- Header: a labelled note attached to an HTTP request or response, written as
Name: value. - Host Authorization middleware: a Rails checkpoint that checks the requested hostname against a list of allowed hosts and rejects unexpected ones.
- Host header: the header telling a server which website the visitor wants, used when one server hosts several sites.
- HTTP Host Header Injection: an attack where the attacker tampers with the Host header to influence how the server behaves.
- HTTP request: the message a browser sends to a server asking for a page or submitting data, with a method, URL, headers and sometimes a body.
- HTTP response: the server's reply, with a status code, headers and usually a body.
- Location header: the response header that holds the address a redirect points to.
- Middleware: a checkpoint every request passes through before reaching application code.
- Open redirect: a flaw where a site redirects visitors to an address taken from the request without proper validation.
- POST: an HTTP method used to send data to the server, such as a login form.
- Regex (regular expression): a pattern used to match text, here used to decide which hostnames are allowed.
- Reverse proxy: a server in front of the application that forwards visitors' requests to it and may add headers along the way.
- Ruby on Rails: a popular web application framework written in Ruby.
- Shodan browser extension: a Chrome add-on that shows information about the server behind the site you are viewing, including possible known vulnerabilities.
- X-Forwarded-Host: a header a proxy adds to tell the backend which hostname the visitor originally requested.