CVEfocus › CVE database › CVE-2021-21289

CVE-2021-21289Command Injection Vulnerability in Mechanize

CVSS 7.4 HighEPSS 3.5% (higher than 90% of CVEs)Published 2021-02-02Updated 2024-08-03Assigner: GitHub_M

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.

CWE-78

What to do

Fixed builds are available from Debian, RubyGems: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

4Fixed
4Fix pending
4Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04ruby-mechanizeNot affected
vulnerable_code_not_present
Ubuntu 25.10ruby-mechanizeNot affected
vulnerable_code_not_present
Ubuntu 24.04ruby-mechanizeNot affected
vulnerable_code_not_present
Ubuntu 22.04ruby-mechanizeNot affected
vulnerable_code_not_present
Ubuntu 20.04ruby-mechanizeFix pending2.7.6-1ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2021-21289
Ubuntu 18.04ruby-mechanizeFix pending2.7.5-2ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2021-21289
Ubuntu 16.04ruby-mechanizeFix pending2.7.3-1ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2021-21289
Ubuntu 14.04ruby-mechanizeFix pending
Debian 14ruby-mechanizeFixed2.7.7-1DEBIAN-CVE-2021-21289
Debian 13ruby-mechanizeFixed2.7.7-1DEBIAN-CVE-2021-21289
Debian 12ruby-mechanizeFixed2.7.7-1DEBIAN-CVE-2021-21289
RubyGems librarymechanizeFixed2.7.7GHSA-qrqm-fpv6-6r8g

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.