Skip to main content

CVE-2022-31033 — Vulnerability in mechanize — CVE Details

MEDIUM

Mechanize before v2.8.5 vulnerable to authorization header leak on port redirect

Published June 9, 2022Updated November 8, 2023Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (1.48%). Schedule for your next planned update.

Does your project use an affected mechanize version?

Paste your Gemfile.lock to check it for CVE-2022-31033 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.

Check my Gemfile.lock

Summary

Summary

Mechanize (rubygem) < v2.8.5 leaks the Authorization header after a redirect to a different port on the same site.

Mitigation

Upgrade to Mechanize v2.8.5 or later.

Notes

See https://curl.se/docs/CVE-2022-27776.html for a similar vulnerability in curl.

Cookies are shared with a server at a different port on the same site, per https://datatracker.ietf.org/doc/html/rfc6265#section-8.5 which states in part:

Cookies do not provide isolation by port. If a cookie is readable by a service running on one port, the cookie is also readable by a service running on another port of the same server. If a cookie is writable by a service on one port, the cookie is also writable by a service running on another port of the same server. For this reason, servers SHOULD NOT both run mutually distrusting services on different ports of the same host and use cookies to store security- sensitive information.

Advisory Timeline

  • First published June 9, 2022 (1630 days ago).
  • Last revised November 8, 2023 — 516 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update mechanize to 2.8.5 or later
gem install mechanize -v 2.8.5

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: RubyGems (1).

PackageFixed In
mechanize RubyGems · Affected: 0.1.0, 0.1.1, 0.1.2, 0.1.3 (+79 more)2.8.5

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 5.9 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N

Frequently Asked Questions

What is CVE-2022-31033?
Mechanize before v2.8.5 vulnerable to authorization header leak on port redirect. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 5.9/10).
How do I check if my project is affected by CVE-2022-31033?
CVE-2022-31033 affects mechanize. It has a 1.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2022-31033 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
5.9

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
1.48%
EPSS percentile: 74.2

This is an above-median EPSS score — 74.2% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.

Also Known As

GHSA-64qm-hrgp-pgr9

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock