Mechanize is an open-source ruby library that makes automated web interaction easy. In Mechanize from version 2.0.0 and…
Summary
Vulnerability reported (CVE-2021-21289). Successful exploitation can lead to full system takeover.
Original description
The description as published by the source.
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#saveand#save!since v2.1 (see 98b2f51, bd62ff0)Mechanize::File#saveand#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.
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2021-21289 has been found.
Successful exploitation can lead to full system takeover.
What to do: apply the vendor's official patched release.
If unsure, ask your IT team or search "CVE-2021-21289" on the vendor's site.
CVE-2021-21289
Attack vector: remote (network-reachable) / unauthenticated
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
A vulnerability (unclassified) has been reported.
Check the vendor advisory for the affected versions.
Severity: ?. Successful exploitation can lead to full system takeover.
Update to the patched release per vendor advisory.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Audit SBOM/dependencies to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
Audit SBOM/dependencies for affected components.資産台帳・SBOM・依存マニフェストで影響コンポーネントを特定する。
-
2Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
Fix status by distribution
Fixed packages published by each distribution for this CVE
- Debian DEBIAN-CVE-2021-21289 ruby-mechanize Fixed in: 2.7.7-1
References
- advisory rubygems.org
- advisory nvd.nist.gov
- package github.com
- web lists.fedoraproject.org
- web lists.fedoraproject.org
- web github.com
- web github.com
- web lists.debian.org
- web security.gentoo.org
- web github.com
- web github.com
- web lists.fedoraproject.org
- web lists.fedoraproject.org
- web rubygems.org