CVE-2022-31033: Mechanize Mechanize Before V2.8.5 Vulnerable To Vulnerability
MODERATECVE-2022-31033 is a MODERATE (CVSS 5.9) mechanize before v2.8.5 vulnerable to vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Mechanize libraries in the RubyGems ecosystem. The issue involves mechanize before v2.8.5 vulnerable to authorization header leak on port redirect. Remediation is available by upgrading affected packages to version 2.8.5.
CVE-2022-31033 at a Glance
Security Impact
CVSS: 5.9
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:U/C:H/I:N/A:N).
How to Fix CVE-2022-31033
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.
Upgrade mechanize to 2.8.5
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-2022-31033, 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.8.5), 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
CVE-2022-31033 Affected Mechanize Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
mechanize
|
RubyGems |
< 2.8.5
|
2.8.5
|
References
Frequently Asked Questions
What is CVE-2022-31033?
Which Mechanize versions are affected?
What version fixes CVE-2022-31033?
Is mechanize affected?
What is the CVSS score of CVE-2022-31033?
What CWE is associated with CVE-2022-31033?
How can I check RubyGems dependencies for CVE-2022-31033?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-64qm-hrgp-pgr9",
"modified" : "2022-07-21T14:53:46Z",
"published" : "2022-06-09T23:47:57Z",
"aliases" : [ "CVE-2022-31033" ],
"summary" : "Mechanize before v2.8.5 vulnerable to authorization header leak on port redirect",
"details" : "**Summary**\n\nMechanize (rubygem) `< v2.8.5` leaks the `Authorization` header after a redirect to a different port on the same site.\n\n**Mitigation**\n\nUpgrade to Mechanize v2.8.5 or later.\n\n**Notes**\n\nSee [https://curl.se/docs/CVE-2022-27776.html](CVE-2022-27776) for a similar vulnerability in curl.\n\nCookies 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:\n\n> Cookies do not provide isolation by port. If a cookie is readable\n> by a service running on one port, the cookie is also readable by a\n> service running on another port of the same server. If a cookie is\n> writable by a service on one port, the cookie is also writable by a\n> service running on another port of the same server. For this\n> reason, servers SHOULD NOT both run mutually distrusting services on\n> different ports of the same host and use cookies to store security-\n> sensitive information.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "mechanize"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.8.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/mechanize/security/advisories/GHSA-64qm-hrgp-pgr9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31033"
}, {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/mechanize/commit/c7fe6996a5b95f9880653ba3bc548a8d4ef72317"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2022-31033.yml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sparklemotion/mechanize"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-522" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-09T23:47:57Z",
"nvd_published_at" : "2022-06-09T20:15:00Z"
}
}