CVE-2021-21289 | Command Injection Vulnerability in Mechanize

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.

Published: 2021-02-02 Last update: 2026-06-16 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2021-21289 is rated Moderate Risk (61.3/100): CVSS High severity, with medium exploitation likelihood (EPSS 3.51%). Core evidence: EPSS rose +1.00% over the last day, indicating growing attacker interest. Mandatory action: Review affected assets and schedule remediation.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2021-21289

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-06-15 2.50% 3.51% +1.00%
2 2025-11-21 1.74% 2.50% +0.76%
3 2025-11-18 1.74%

Full EPSS history (14 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2021-21289

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
7.4 3.1 HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:N)
Doesn’t really leak secrets in a meaningful way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:N)
Service keeps running; no real outage angle.
2.8 4.0 [email protected]
8.3 3.1 HIGH
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:C)
Breaking this can reach past the original component and bite other resources—bigger blast radius.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.
1.6 6.0 [email protected]
7.6 2.0 HIGH
AV:N/AC:H/Au:N/C:C/I:C/A:C Click to expand
Access vector (AV:N)
Can be exploited remotely over network reachability.
Access complexity (AC:H)
Exploitation requires uncommon or highly specific conditions.
Authentication (AU:N)
No authentication is required.
Confidentiality impact (C:C)
Complete confidentiality impact.
Integrity impact (I:C)
Complete integrity impact.
Availability impact (A:C)
Complete availability impact.
4.9 10.0 [email protected]

Weakness enumeration for CVE-2021-21289

GitHub Security Advisory for CVE-2021-21289

GHSA-qrqm-fpv6-6r8g · Severity: high · Ecosystem: rubygems — Command Injection Vulnerability in Mechanize

OS Trackers for CVE-2021-21289

vendor priority summary link
debian not yet assigned CVE-2021-21289 not yet assigned priority: Debian including 1 source packages (ruby-mechanize), 5 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): resolved 5. https://security-tracker.debian.org/tracker/CVE-2021-21289
gentoo high CVE-2021-21289: 1 GLSA(s) (202107-17), 1 atom(s) (dev-ruby/mechanize); latest impact high. https://bugs.gentoo.org/buglist.cgi?quicksearch=CVE-2021-21289
redhat medium https://access.redhat.com/security/cve/CVE-2021-21289
ubuntu medium CVE-2021-21289 medium priority: Ubuntu including 1 source packages (ruby-mechanize), 16 status rows across 16 suites (bionic, focal, groovy, hirsute, impish, jammy, kinetic, lunar, mantic, noble, oracular, plucky, questing, trusty, upstream, xenial): not-affected 6, ignored 4, needs-triage 4, DNE 1, released 1. https://ubuntu.com/security/CVE-2021-21289

Affected software / configurations for CVE-2021-21289

Vendor Product Version Raw CPE
mechanize_project mechanize >= 2.0, < 2.7.7 cpe:2.3:a:mechanize_project:mechanize:*:*:*:*:*:ruby:*:*
fedoraproject fedora 32 cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*
fedoraproject fedora 33 cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*
debian debian_linux 9.0 cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*

References for CVE-2021-21289

URL Tags
https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0 Patch Third Party Advisory
https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7 Release Notes Third Party Advisory
https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g Third Party Advisory
https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html Mailing List Third Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/
https://rubygems.org/gems/mechanize/ Product Third Party Advisory
https://security.gentoo.org/glsa/202107-17 Third Party Advisory
cvelogic Threat Intelligence