CVE-2021-21289
published high CVSS 3.1 · 7.4Command Injection Vulnerability in Mechanize
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| sparklemotion | — | mechanize>= 2.0, < 2.7.7 | Affected | Not stated | GitHub_M |
| Debian | stretch | ruby-mechanize | Advisory build | 2.7.5-1+deb9u1 | DLA-2561-1 |
| Ubuntu | bionic | ruby-mechanize | Advisory build | 2.7.5-2ubuntu0.1~esm1 | USN-9148-1 |
| Ubuntu | focal | ruby-mechanize | Advisory build | 2.7.6-1ubuntu0.1~esm1 | USN-9148-1 |
| Ubuntu | xenial | ruby-mechanize | Advisory build | 2.7.3-1ubuntu0.1~esm1 | USN-9148-1 |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.4 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| sparklemotion | mechanize | >= 2.0, < 2.7.7 (affected) | GitHub_M · cna |
Weaknesses
1- CWE-78 CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
References
8- https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0
- https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7
- https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g
- [debian-lts-announce] 20210216 [SECURITY] [DLA 2561-1] ruby-mechanize security update https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html
- FEDORA-2021-24fdc228e4 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/
- FEDORA-2021-db8ebc547e https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/
- https://rubygems.org/gems/mechanize/
- GLSA-202107-17 https://security.gentoo.org/glsa/202107-17
Provider assertions
2GitHub_M · cna
Command Injection Vulnerability in Mechanize
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- a80bb25b6c432475be5e72154f3e73213b215dcf8e83f5b45aa07902b23b20f8
- Ingested
- 23 Sep 2026, 07:52:31 UTC
- Source record
- Official CVE record