Vulnerability · Published Feb 2, 2021 · Assigned by GitHub_M
CVE-2021-21289Command Injection Vulnerability in Mechanize
High 7.4
In plain English
A high-severity OS command injection in mechanize from sparklemotion. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 3.5% (higher than 89% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | ruby-mechanize | 2.7.7-1 | DEBIAN-CVE-2021-21289 |
| Debian:13 | ruby-mechanize | 2.7.7-1 | DEBIAN-CVE-2021-21289 |
| Debian:14 | ruby-mechanize | 2.7.7-1 | DEBIAN-CVE-2021-21289 |
| RubyGems | mechanize | 2.7.7 | GHSA-qrqm-fpv6-6r8g |
| Ubuntu:22.04:LTS | ruby-mechanize | no fix listed | UBUNTU-CVE-2021-21289 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| sparklemotion | mechanize | >= 2.0, < 2.7.7 |
Weakness: CWE-78 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N
References
- https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g x_refsource_CONFIRM
- https://rubygems.org/gems/mechanize/ x_refsource_MISC
- https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7 x_refsource_MISC
- https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0 x_refsource_MISC
- FEDORA-2021-24fdc228e4 vendor-advisory, x_refsource_FEDORA
- FEDORA-2021-db8ebc547e vendor-advisory, x_refsource_FEDORA
- [debian-lts-announce] 20210216 [SECURITY] [DLA 2561-1] ruby-mechanize security update mailing-list, x_refsource_MLIST
- GLSA-202107-17 vendor-advisory, x_refsource_GENTOO