Divulgation d'information dans mechanize (CVE-2026-107715)
Résumé
Vulnérabilité dans mechanize (CVE-2026-107715). Des informations confidentielles peuvent être exposées. Exploitable via mechanize. Atténuation : mise à jour vers 2.14.1 ou plus.
Description d'origine
La description telle que publiée par la source (souvent en anglais).
Summary
mechanize leaked credentials to the redirect target when an HTTP redirect crossed to another host. Credentials set through Mechanize#request_headers= leaked even when they were Authorization.
Details
Two defects, both in lib/mechanize/http/agent.rb.
1. Mechanize#request_headers= bypassed the redirect strip entirely. #request_add_headers copied @request_headers onto every request unconditionally, with no host check, including the request issued after a redirect. The strip in #response_redirect mutated only the per-request headers hash and never touched agent state. Because request_headers= is the documented way to set a default credential for every request, the header the code explicitly protected — Authorization — was the one most likely to leak.
2. The strip list omitted Proxy-Authorization and Cookie2. Only CREDENTIAL_HEADERS = ['Authorization'] and COOKIE_HEADERS = ['Cookie'] were removed from the per-request headers hash on a cross-host redirect.
Cookies held in Mechanize#cookie_jar and credentials held in Mechanize::HTTP::AuthStore are not affected. Both are looked up per-URI, so they never follow a redirect to a foreign host. The exposure was limited to headers the caller set by hand.
PoC
agent = Mechanize.new
agent.request_headers = { 'Authorization' => 'Bearer secret' }
agent.get('https://example.test/redirects-to-attacker')
# the request to the attacker's host carries "Authorization: Bearer…
Source: GitHub Security Advisories (Global) NVD GitHub Advisory
Résumé généré automatiquement
Assemblé par SecPulse à partir des données sources (CVSS, CWE, versions affectées) à l'aide de modèles, sans IA. Vérifiez la description d'origine et les références ci-dessous.
Une vulnérabilité référencée CVE-2026-107715 a été découverte dans mechanize.
Des attaquants peuvent cibler un point d'entrée spécifique comme mechanize à distance pour détourner le produit.
Des informations confidentielles peuvent être exposées. Score CVSS : 6.8/10.
Action : mettez à jour mechanize vers 2.14.1 ou supérieur.
En cas de doute, contactez votre service informatique ou cherchez « mechanize CVE-2026-107715 » sur le site de l'éditeur.
CVE-2026-107715 (mechanize) — CWE-200 / CVSS v3 6.8
Vecteur d'attaque : distant (réseau) / non authentifié / sans interaction utilisateur
Surface d'attaque : mechanize / Authorization / Cookie2 / headers
Correctif : 2.14.1 — appliquer immédiatement
Contournement : Set Mechanize#redirect_ok = false and handle redirects explicitly, or avoid request_headers= for credentials and pass them per-request only to hosts you intend to authenticate to.
Plan : 1) Audit SBOM, 2) Mise à jour staging→prod, 3) Surveillance WAF/proxy sur les endpoints affectés, 4) Recherche d'IOC dans les logs.
Réfs : voir GHSA / avis éditeur / version corrigée liés sur cette page.
Une divulgation d'information (CWE-200) affecte mechanize. Les attaquants atteignent le code vulnérable via mechanize sans authentification.
Consultez l'avis de l'éditeur pour les versions affectées de mechanize. Surface d'attaque : mechanize / Authorization / Cookie2 / headers.
Gravité : Moyenne (CVSS 6.8/10). Des informations confidentielles peuvent être exposées.
Mettre à jour vers 2.14.1.
Contournement : Set Mechanize#redirect_ok = false and handle redirects explicitly, or avoid request_headers= for credentials and pass them per-request only to hosts you intend to authenticate to.
Recherchez dans les logs des requêtes correspondant aux IOC connus de cette CVE. Auditez les SBOM/dépendances.
Actions de réponse
Étapes concrètes et exemples de commandes que les équipes SOC/SRE doivent exécuter dans l'ordre
-
1Identify exposure identify
grep -r 'mechanize' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
mechanizeを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply temporary workaround mitigate
Set `Mechanize#redirect_ok = false` and handle redirects explicitly, or avoid `request_headers=` for credentials and pass them per-request only to hosts you intend to authenticate to.パッチが適用されるまでの応急処置として、Set
Mechanize#redirect_ok = falseand handle redirects explicitly, or avoidrequest_headers=for credentials and pass them per-request only to hosts you intend to authenticate to. を実施。回避策の副作用 (機能低下) を確認した上で。 -
3Apply patch patch
Upgrade mechanize to 2.14.1ステージング環境で 2.14.1 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
4Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。