CVE-2021-21289
HIGH 8.3CVSS 3.1Command Injection Vulnerability in Mechanize
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.
- Published
- 2 Feb 2021
- Last modified
- 10 Sep 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-78
- Also known as
- GHSA-qrqm-fpv6-6r8g
- Sources
- NVDJSONOSV GHSA-qrqm-fpv6-6r8gJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 8.3 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | HIGH 7.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N |
| OSV | GitHub | CVSS 3.1 | HIGH 7.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | HIGH 7.6 | AV:N/AC:H/Au:N/C:C/I:C/A:C |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | mechanize_project | mechanizecpe:2.3:a:mechanize_project:mechanize:*:*:*:*:*:ruby:*:* |
>= 2.0, < 2.7.7 | 2.7.7 |
| NVD | fedoraproject | fedoracpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:* |
= 32 | |
| NVD | fedoraproject | fedoracpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:* |
= 33 | |
| NVD | debian | debian_linuxcpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* |
= 9.0 | |
| OSV | RubyGems | mechanize | >= 2.0.0, < 2.7.7 | 2.7.7 |
References
- https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0 · Patch, Third Party Advisory, WEB
- https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7 · Release Notes, Third Party Advisory, WEB
- https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g · Third Party Advisory, WEB
- https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html · Mailing List, Third Party Advisory, WEB
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/
- https://rubygems.org/gems/mechanize/ · Product, Third Party Advisory, WEB
- https://security.gentoo.org/glsa/202107-17 · Third Party Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2021-21289 · ADVISORY
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml · WEB
- https://github.com/sparklemotion/mechanize · PACKAGE
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV · WEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V · WEB
History
- 25 Nov 2026 20:32 UTC · NVD: first stored (published 2 Feb 2021)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 2 Feb 2021)