CVE-2026-107399: Mechanize Mechanize Sends Credential Headers To Vulnerability

MODERATE
Advisory Identifier: GHSA-c6rp-p8xm-4q9f
CVSS 6.8
CWE-522 CWE-200
Published
Advisory Summary

CVE-2026-107399 is a MODERATE (CVSS 6.8) mechanize sends credential headers to vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Mechanize libraries in the RubyGems ecosystem. The issue involves mechanize sends credential headers to another origin after a meta refresh. Remediation is available by upgrading affected packages to version 2.14.1.

CVE-2026-107399 at a Glance

CVE Identifier CVE-2026-107399
GHSA Identifier GHSA-c6rp-p8xm-4q9f
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Mechanize
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 6.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-107399

To remediate this vulnerability, upgrade all affected Mechanize dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mechanize fixed: 2.14.1
Upgrade mechanize to 2.14.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mechanize

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-107399, inspect your project dependencies for Mechanize:

inspect dependencies for mechanize

Analyze the terminal output to locate any version of Mechanize in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.14.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In Mechanize, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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.

CVE-2026-107399 Affected Mechanize Versions

1 component(s)
Fixed Versions:
2.14.1
Product / Package Ecosystem Affected Versions Fixed Version
mechanize
RubyGems
< 2.14.1
2.14.1

References

Frequently Asked Questions

What is CVE-2026-107399?
CVE-2026-107399 is a security vulnerability in Mechanize involving Mechanize sends credential headers to another origin after a meta refresh under CWE-522: Insufficiently Protected Credentials.
Which Mechanize versions are affected?
Affected versions include releases prior to 2.14.1 across affected packages: mechanize.
What version fixes CVE-2026-107399?
Upgrading to 2.14.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mechanize affected?
Yes, mechanize is affected in releases prior to 2.14.1. Upgrade your dependency to 2.14.1 or later.
What is the CVSS score of CVE-2026-107399?
CVE-2026-107399 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2026-107399?
CVE-2026-107399 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check RubyGems dependencies for CVE-2026-107399?
Run the dependency tree command: 'inspect dependencies for mechanize'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c6rp-p8xm-4q9f",
  "modified" : "2026-10-08T22:09:03Z",
  "published" : "2026-10-08T22:09:03Z",
  "aliases" : [ "CVE-2026-107399" ],
  "summary" : "Mechanize sends credential headers to another origin after a meta refresh",
  "details" : "## Summary\n\n`mechanize` applied no trust boundary to a `meta` refresh, so credentials set through `Mechanize#request_headers=` followed a refresh that pointed at another origin.\n\n## Details\n\n`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.\n\nThe refresh fetch passes an empty per-request headers hash, so only headers set through `Mechanize#request_headers=` were exposed.\n\nThis 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.\n\n## Impact\n\nAn 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.\n\n## Patches\n\nFixed 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.\n\n## Workarounds\n\nLeave `Mechanize#follow_meta_refresh` at its default of `false`, or avoid `request_headers=` for credentials when it is enabled.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "mechanize"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.14.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/mechanize/security/advisories/GHSA-c6rp-p8xm-4q9f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/mechanize/pull/676"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/mechanize/commit/02a1235842d6eda8d4a5a3d8f13aba2cecf52e4f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/mechanize/commit/84c74df87d15f5d119df268ba6aa79bc1e16a2c3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sparklemotion/mechanize"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sparklemotion/mechanize/releases/tag/v2.14.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-522" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-08T22:09:03Z",
    "nvd_published_at" : null
  }
}