Skip to content
OpenAdvisories
High · 7.4 CVE-2021-21289 EUVD-2021-0569GHSA-qrqm-fpv6-6r8g

Command Injection Vulnerability in Mechanize

Published Feb 2, 2021 · Updated Aug 3, 2024 · Assigned by GitHub_M

Description

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.

Affected products

VendorProductAffectedFixed
sparklemotion mechanize >= 2.0, < 2.7.7 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 ruby-mechanize 2.7.7-1 —
Debian 13 ruby-mechanize 2.7.7-1 —
Debian 12 ruby-mechanize 2.7.7-1 —
Debian 9 ruby-mechanize 2.7.5-1+deb9u1 DLA-2561-1
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS ruby-mechanize No fix yet —
Ubuntu 20.04 LTS ruby-mechanize No fix yet —
Ubuntu 18.04 LTS ruby-mechanize No fix yet —
Ubuntu 16.04 LTS ruby-mechanize No fix yet —

Affected packages

EcosystemPackageAffectedFixedRecord
RubyGems mechanize >= 2.0.0, < 2.7.7 2.7.7 GHSA-qrqm-fpv6-6r8g

Advisories 1

References