CVE-2021-21289Mechanize Project Mechanize
High 8.3 No auth needed
Follow: this CVE · Mechanize Project · Mechanize Project Mechanize We alert you by email or Slack (account required).
- Priority
- 65
- CVSS 3.1
- 8.3
- EPSS
- 3.5% probability of exploitation in 30 days · percentile 90
- Auth required
- No
- Published
- Feb 2, 2021
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-78
- Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H
What happens
Mechanize is an open-source ruby library that makes automated web interaction easy. In Mechanize from version 2.0.0 and before version 2.7.7 there is a command injection vulnerability. Affected versions of mechanize allow 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, Mechanize::CookieJar#save_as, Mechanize#download, Mechanize::Download#save, Mechanize::File#save, and Mechanize::FileResponse#read_body. This is fixed in version 2.7.7.
What to do
- Apply the vendor's security update for Mechanize.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| RubyGems | mechanize |
≥ 2.0.0 < 2.7.7 |
2.7.7 |
gem "mechanize", ">= 2.7.7" |
Per OSV / GitHub Advisories (GHSA-qrqm-fpv6-6r8g). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| mechanize_project | mechanize | ≥ 2.0 < 2.7.7 |
| fedoraproject | fedora | 32 |
| fedoraproject | fedora | 33 |
| debian | debian_linux | 9.0 |
Official sources
References
Links published by the sources. Open them with care.
- github.com Patch Third Party Advisory
- github.com Release Notes Third Party Advisory
- github.com Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- lists.fedoraproject.org
- lists.fedoraproject.org
- rubygems.org Product Third Party Advisory
- security.gentoo.org Third Party Advisory