CVE-2021-21289 json
Command Injection Vulnerability in Mechanize
published 5y ago modified last mo. also GHSA-qrqm-fpv6-6r8g , EUVD-2021-0569
- cvss
- 7.4
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 3.5%
- EPSS 3.5% chance of exploitation in 30 days, percentile 89%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- rubygems mechanize 2.7.7
- mechanize_project mechanize 2.7.7
- ruby-mechanize Debian 14, Debian 13, Debian 12 2.7.7-1
debian advisories DEBIAN-CVE-2021-21289
Is CVE-2021-21289 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerVendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-21289 updated cvss 8.3
rubygem-mechanize: OS command injection via untrusted input to Ruby's Kernel.open method
-
Red Hat 3scale API Management Platform 2 mechanize mechanizeaffected: no fix planned “Will not fix”
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
3.55% chance of exploitation in the next 30 days, higher than 89% of all scored CVEs (FIRST EPSS, 2026-11-09).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N |
| NVD | 3.1 | 8.3 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H |
| NVD | 2.0 | 7.6 | AV:N/AC:H/Au:N/C:C/I:C/A:C |
| GitHub | 3.1 | 7.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| rubygems | mechanize | >=2.0.0, <2.7.7 |
2.7.7 |
Affected products
- sparklemotion mechanize
Classification
- Weakness
-
- CWE-78 Improper Neutralization of Special Elements used in an OS Command
References
-
github.com
/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0
web, patch, third-party-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/
vendor-advisory
-
security.gentoo.org
/glsa/202107-17
vendor-advisory, web, third-party-advisory
-
github.com
/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g
web, third-party-advisory
-
rubygems.org
/gems/mechanize/
product, third-party-advisory
-
github.com
/sparklemotion/mechanize/releases/tag/v2.7.7
web, release-notes, third-party-advisory
-
lists.debian.org
/debian-lts-announce/2021/02/msg00021.html
mailing-list, web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-21289
advisory
-
github.com
/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml
web
-
github.com
/sparklemotion/mechanize
package
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V
web
-
rubygems.org
/gems/mechanize
web
Sources
- CVE List CVE-2021-21289
- GitHub Advisory GHSA-qrqm-fpv6-6r8g
- NVD CVE-2021-21289
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.