
Cloud Vulnerability DB
A community-led vulnerabilities database
MetaInspector can expose manually supplied cookies and other credential headers when a page redirects to a different origin.
HttpSession#build installs caller-supplied headers on the Faraday connection. The redirect middleware reuses those headers across redirect requests. Before this patch, MetaInspector applied an origin header policy to image requests, but not to page redirects.
MetaInspector forwards custom request headers when following a page redirect to a different origin. Applications that pass sensitive values through headers: or faraday_options[:headers] can expose those values to the redirect destination.
Affected headers include manually supplied Cookie, Proxy-Authorization, and arbitrary API-key headers. Cross-origin redirects include a different host, a subdomain, a different port, and an HTTPS-to-HTTP downgrade. In the downgrade case, the forwarded values may be transmitted without TLS.
Faraday's redirect middleware removes Authorization for many cross-origin redirects, but that does not protect arbitrary credential headers. An Authorization header can also survive a protocol-relative cross-host redirect such as //other.example/landing with the dependency version tested.
Exploitation requires the application to supply sensitive request headers and the requested site to redirect to an origin that should not receive them. Applications using only the default MetaInspector headers do not expose application credentials through this issue.
Run with MetaInspector 5.21.0 and WebMock. This example uses test credentials and makes no real network requests.
require 'metainspector'
require 'webmock'
include WebMock::API
WebMock.enable!
WebMock.disable_net_connect!
received = nil
stub_request(:get, 'https://trusted.example/start')
.to_return(status: 302, headers: { 'Location' => 'https://other.example/landing' })
stub_request(:get, 'https://other.example/landing').to_return do |request|
received = request.headers
{ status: 200, headers: { 'Content-Type' => 'text/html' }, body: '<title>landing</title>' }
end
MetaInspector.new('https://trusted.example/start',
headers: { 'Cookie' => 'session=TEST_SECRET', 'X-Api-Key' => 'TEST_SECRET' })
p received.select { |_, value| value.include?('TEST_SECRET') }.keys
# Vulnerable: ["Cookie", "X-Api-Key"]
# With the patch: []Applications that supply a session cookie, proxy credentials or an API key can disclose those credentials to an untrusted redirect destination. An attacker controlling the destination may then use the leaked credentials with the privileges they grant. An HTTPS-to-HTTP redirect can additionally expose the values to network observers. Applications using only the default MetaInspector headers do not expose application credentials through this issue.
The fix will be released only on the maintained 5.x line. No backports are planned for the 2.x, 3.x or 4.x lines; users of those versions should upgrade to 5.21.1 or later, or apply the workarounds below.
Fixed in MetaInspector 5.21.1, a security-only release based on 5.21.0. Upgrade to 5.21.1 or later. The published package was verified against the reviewed release source.
Release: https://rubygems.org/gems/metainspector/versions/5.21.1
Fix: https://github.com/jaimeiniesta/metainspector/commit/a5dfc6b554280642dd053c14d949f28add4c89d3
The patch retains custom headers only on the initial page origin, comparing scheme, host, and effective port. When the origin differs, only User-Agent, Accept, Accept-Language, and Accept-Encoding are forwarded.
The policy covers GET and optional HEAD requests and runs after redirect callbacks, including when clear_authorization_header: false is configured. Image downloads keep their existing cross-origin protection and cannot reintroduce the initial credentials after a page redirects to another origin. Generated image Range headers remain supported.
There is no option to disable this protection. Applications relying on credential forwarding between distinct origins must adjust that integration.
If upgrading is not immediately possible, avoid supplying sensitive headers. On MetaInspector 3.0.0 and later, automatic redirects can be disabled using allow_redirections: false. Do not rely on that option to disable ordinary HTTP redirects in 2.x, whose open-uri transport behaves differently. On versions supporting url_filter:, applications can also reject every destination outside the initial origin.
Affected releases: >= 2.2.0, <= 5.21.0. Custom request header support was introduced in commit 2ec4216, first released in 2.2.0; 2.1.0 did not support these headers. The original request implementations from tags 2.2.0 (open-uri, Ruby 2.7.5) and 3.0.0 (Faraday 1.10.6 with faraday_middleware 1.2.1, Ruby 4.0.5) were reproduced against two local HTTP servers on different ports: both forwarded Cookie and X-Api-Key to the other origin. The published 5.21.0 release was also confirmed affected. The first patched release is 5.21.1.
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."