cbcvebase.
CVE-2021-22881
published 2021-02-11

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. Specially crafted `Host` headers in…

PriorityP264medium6.1CVSS 3.1
AVNACLPRNUIRSCCLILAN
EXPLOIT
EPSS
87.30%
99.7th percentile
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

19 ranges
VendorProductVersion rangeFixed in
actionpack_projectactionpack>= 6.0.0 < 6.0.4.26.0.4.2
actionpack_projectactionpack>= 6.0.0 < 6.0.3.56.0.3.5
actionpack_projectactionpack>= 6.0.0 < 6.0.4.16.0.4.1
actionpack_projectactionpack>= 6.1.0 < 6.1.4.26.1.4.2
actionpack_projectactionpack>= 6.1.0 < 6.1.2.16.1.2.1
actionpack_projectactionpack>= 6.1.0 < 6.1.4.16.1.4.1
actionpack_projectactionpack>= 6.1.0.rc2 < 6.1.3.26.1.3.2
debianrails< rails 2:6.0.3.5+dfsg-1 (bookworm)rails 2:6.0.3.5+dfsg-1 (bookworm)
debianrails
fedoraprojectfedora
httpsgithub.com_rails_rails
rubyonrailsrails
rubyonrailsrails>= 0 < 2:6.0.3.5+dfsg-12:6.0.3.5+dfsg-1
rubyonrailsrails>= 0 < 2:6.0.3.5+dfsg-12:6.0.3.5+dfsg-1
rubyonrailsrails>= 0 < 2:6.0.3.5+dfsg-12:6.0.3.5+dfsg-1
rubyonrailsrails>= 0 < 2:6.0.3.5+dfsg-12:6.0.3.5+dfsg-1
rubyonrailsrails>= 6.0.0 < 6.0.3.56.0.3.5
rubyonrailsrails>= 6.1.0 < 6.1.2.16.1.2.1
rubyonrailsrails>= 6.1.1 < 6.1.3.26.1.3.2

Detection & IOCsextracted from sources · hover to see the quote

otherGET / HTTP/1.1 Host: interact.sh#{{randstr}}.{{Hostname}}
regex(?m)^(?:Location\s*?:\s*?)(?:https?://|//)?(?:[a-zA-Z0-9\-_\.@]*)interact\.sh.*$
  • Look for HTTP 301/302 redirect responses where the Location header points to an external domain not matching the application's configured allowed hosts — indicative of Host header injection exploitation.
  • Monitor for crafted Host headers containing a fragment identifier (#) followed by a domain, used to bypass Host Authorization middleware with leading-dot allowed host configurations.
  • Inspect X-Forwarded-Host header values for mixed-case or uppercase domain names that may bypass the missing `.downcase` normalization in host_authorization.rb, allowing unauthorized hosts to pass the `forwarded_host.nil?` check.
  • Flag inbound requests where the X-Forwarded-Host header contains a value that differs in case from the Host header, particularly when the application has allowed hosts configured with leading dots (e.g., `.EXAMPLE.com`).
  • Alert on the vulnerable code path in actionpack/lib/action_dispatch/middleware/host_authorization.rb at line 115 where forwarded_host regex match is performed without downcasing the X-Forwarded-Host value.
  • ·Only applications with allowed hosts containing a leading dot in their config.hosts are impacted by CVE-2021-22881.
  • ·Red Hat Satellite is not affected because it does not use the config.hosts setting.
  • ·The X-Forwarded-Host bypass variant (CVE-2021-22942) affects Rails <= 6.1.3.1 and requires the application to have uppercase or mixed-case entries in config.hosts (e.g., 'Evil.com').

CVSS provenance

nvdv3.16.1MEDIUMCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
nvdv2.05.8MEDIUMAV:N/AC:M/Au:N/C:P/I:P/A:N
ghsa6.1MEDIUM
osv6.1MEDIUM
vendor_debian6.1LOW
vendor_redhat6.1MEDIUM
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.