CVE-2026-107399 — Vulnerability in mechanize — CVE Details
Mechanize sends credential headers to another origin after a meta refresh
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.46%). Schedule for your next planned update.
Does your project use an affected mechanize version?
Paste your Gemfile.lock to check it for CVE-2026-107399 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
mechanize applied no trust boundary to a meta refresh, so credentials set through Mechanize#request_headers= followed a refresh that pointed at another origin.
Details
Mechanize::HTTP::Agent#response_follow_meta_refresh fetched the refresh target with no notion of a crossed origin, so @request_headers were re-applied in full. An attacker who could place a meta refresh in a page the agent fetched — through stored content, an open redirect, or control of any page in the crawl — collected the same credentials as through an HTTP redirect, on a code path that had none of the redirect path's protections.
The refresh fetch passes an empty per-request headers hash, so only headers set through Mechanize#request_headers= were exposed.
This requires Mechanize#follow_meta_refresh = true. It is false by default, so an agent in its default configuration is not affected. Crawlers commonly enable it.
Impact
An attacker who can place a meta refresh in any page the agent fetches captures bearer tokens and session cookies set through request_headers=. Disclosure only; no integrity or availability impact.
Patches
Fixed in mechanize v2.14.1. A meta refresh that points at another origin is now subject to the same rule as an HTTP redirect: credentials and cookies are withheld from the request that follows it.
Workarounds
Leave Mechanize#follow_meta_refresh at its default of false, or avoid request_headers= for credentials when it is enabled.
Advisory Timeline
- First published October 8, 2026 (49 days ago).
- Last revised October 8, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install mechanize -v 2.14.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: RubyGems (1).
| Package | Fixed In |
|---|---|
| mechanize RubyGems · Affected: 0.1.0, 0.1.1, 0.1.2, 0.1.3 (+91 more) | 2.14.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-200Information ExposureMITRE
- CWE-522
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N
References
- https://github.com/sparklemotion/mechanize/security/advisories/GHSA-c6rp-p8xm-4q9fWEB
- https://github.com/sparklemotion/mechanize/pull/676WEB
- https://github.com/sparklemotion/mechanize/commit/02a1235842d6eda8d4a5a3d8f13aba2cecf52e4fWEB
- https://github.com/sparklemotion/mechanize/commit/84c74df87d15f5d119df268ba6aa79bc1e16a2c3WEB
- https://github.com/sparklemotion/mechanizePACKAGE
- https://github.com/sparklemotion/mechanize/releases/tag/v2.14.1WEB
Frequently Asked Questions
- What is CVE-2026-107399?
- Mechanize sends credential headers to another origin after a meta refresh. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.8/10).
- How do I check if my project is affected by CVE-2026-107399?
- CVE-2026-107399 affects mechanize. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-107399 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 31.7% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2021-21289HIGH
Command Injection Vulnerability in Mechanize
- CVE-2026-107715MEDIUM
Mechanize sends credential headers to another host after an HTTP redirect
- CVE-2026-128084MEDIUM
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
- CVE-2022-31033MEDIUM
Mechanize before v2.8.5 vulnerable to authorization header leak on port redirect
- CVE-2026-115472MEDIUM
Doorkeeper: When using public clients, any client can revoke any access token