CVE-2021-21289

Command Injection Vulnerability in Mechanize

HIGH
8.3
CVSS Score
Published: February 2, 2021 at 06:50 PM UTC
Updated: June 17, 2026 at 03:35 AM UTC
4 products affected across 4 vendorsDebian LinuxFedoraMechanize

Using mechanize by sparklemotion?

Get instant alerts when new vulnerabilities affect mechanize - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH8.3
Exploit prediction
EPSS 4%

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

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

2.0 ≤ v < 2.7.7
Affected range stops below 2.7.7, so it looks safe — our inference, not a vendor statement
v < 2.7.7
Affected range stops below 2.7.7, so it looks safe — our inference, not a vendor statement

CVSS

Attack Vector
NETWORK
Complexity
HIGH
Privileges
NONE
User Interaction
REQUIRED
Scope
CHANGED
Confidentiality
HIGH
Integrity
HIGH
Availability
HIGH
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-78

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card