GHSA-qrqm-fpv6-6r8g

Suggest an improvement
Source
https://github.com/advisories/GHSA-qrqm-fpv6-6r8g
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/02/GHSA-qrqm-fpv6-6r8g/GHSA-qrqm-fpv6-6r8g.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-qrqm-fpv6-6r8g
Aliases
Published
2021-02-02T18:50:27Z
Modified
2024-02-20T05:34:22.194513Z
Severity
  • 7.4 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N CVSS Calculator
Summary
Command Injection Vulnerability in Mechanize
Details

This security advisory has been created for public disclosure of a Command Injection vulnerability that was responsibly reported by @kyoshidajp (Katsuhiko YOSHIDA).

Impact

Mechanize >= v2.0, < v2.7.7 allows for OS commands to be injected using several classes' methods which implicitly use Ruby's Kernel.open method. Exploitation is possible only if untrusted input is used as a local filename and passed to any of these calls:

  • Mechanize::CookieJar#load: since v2.0 (see 208e3ed)
  • Mechanize::CookieJar#save_as: since v2.0 (see 5b776a4)
  • Mechanize#download: since v2.2 (see dc91667)
  • Mechanize::Download#save and #save! since v2.1 (see 98b2f51, bd62ff0)
  • Mechanize::File#save and #save_as: since v2.1 (see 2bf7519)
  • Mechanize::FileResponse#read_body: since v2.0 (see 01039f5)

Patches

These vulnerabilities are patched in Mechanize v2.7.7.

Workarounds

No workarounds are available. We recommend upgrading to v2.7.7 or later.

References

See https://docs.rubocop.org/rubocop/cops_security.html#securityopen for background on why Kernel.open should not be used with untrusted input.

For more information

If you have any questions or comments about this advisory, please open an issue in sparklemotion/mechanize.

Database specific
{
    "nvd_published_at": "2021-02-02T19:15:00Z",
    "cwe_ids": [
        "CWE-78"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2021-02-02T18:50:15Z"
}
References

Affected packages

RubyGems / mechanize

Package

Name
mechanize
Purl
pkg:gem/mechanize

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.0.0
Fixed
2.7.7

Affected versions

2.*

2.0
2.0.1
2.1.pre.1
2.1
2.1.1
2.2
2.2.1
2.3
2.4
2.5
2.5.1
2.6.0
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6