Skip to content
Fencer Intel
high 7.4

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 Fencer

Vendor 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 mechanize
    affected: 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

Sources

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.