{"id":"CVE-2026-107399","aliases":["GHSA-c6rp-p8xm-4q9f"],"url":"https://o3.security/vulnerability/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.","published":"2026-10-08T21:24:46.349Z","modified":"2026-10-21T02:54:36.641856359Z","cvss":{"score":6.8,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"RubyGems","name":"mechanize","fixedVersion":"2.14.1"}],"fix":{"url":"https://github.com/sparklemotion/mechanize/commit/02a1235842d6eda8d4a5a3d8f13aba2cecf52e4f","label":"sparklemotion/mechanize@02a1235"},"references":[{"type":"WEB","url":"https://github.com/sparklemotion/mechanize/releases/tag/v2.14.1"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/107xxx/CVE-2026-107399.json"},{"type":"ADVISORY","url":"https://github.com/sparklemotion/mechanize/security/advisories/GHSA-c6rp-p8xm-4q9f"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107399"},{"type":"FIX","url":"https://github.com/sparklemotion/mechanize/commit/02a1235842d6eda8d4a5a3d8f13aba2cecf52e4f"},{"type":"FIX","url":"https://github.com/sparklemotion/mechanize/commit/84c74df87d15f5d119df268ba6aa79bc1e16a2c3"},{"type":"FIX","url":"https://github.com/sparklemotion/mechanize/pull/676"},{"type":"PACKAGE","url":"https://github.com/sparklemotion/mechanize"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-21T02:54:36.641856359Z"}}