# CVE-2021-21289: Command Injection Vulnerability in Mechanize

- Severity: High 7.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 3.55%, higher than 89% of CVEs (2026-12-01)
- Published: 2021-02-02T18:50:13.000Z
- Modified: 2026-09-10T03:48:25.998Z
- Also known as: GHSA-qrqm-fpv6-6r8g
- Weaknesses: CWE-78
- 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.

(As written by CVE List.)

## Affected

- sparklemotion mechanize: >= 2.0, < 2.7.7
- mechanize (RubyGems): from 2.0.0 before 2.7.7
- mechanize_project mechanize: from 2.0 before 2.7.7
- fedoraproject fedora: 32; 33
- debian debian_linux: 9.0

## Every score

- GitHub_M: CVSS:3.1 7.4 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N`
- GitHub: CVSS:3.1 7.4 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N`
- NVD: CVSS:3.1 8.3 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H`
- NVD: CVSS:2.0 7.6 High `AV:N/AC:H/Au:N/C:C/I:C/A:C`

## References

- <https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g> (third-party-advisory, web)
- <https://rubygems.org/gems/mechanize/> (product, third-party-advisory)
- <https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7> (release-notes, third-party-advisory, web)
- <https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0> (patch, third-party-advisory, web)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/> (vendor-advisory)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/> (vendor-advisory)
- <https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html> (mailing-list, third-party-advisory, web)
- <https://security.gentoo.org/glsa/202107-17> (third-party-advisory, vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-21289> (advisory)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml> (web)
- <https://github.com/sparklemotion/mechanize> (package)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V> (web)
- <https://rubygems.org/gems/mechanize> (web)

## Sources

- CVE List: [CVE-2021-21289](https://www.cve.org/CVERecord?id=CVE-2021-21289), CVE Terms of Use, modified 2024-08-03
- GitHub Advisory Database: [GHSA-qrqm-fpv6-6r8g](https://github.com/advisories/GHSA-qrqm-fpv6-6r8g), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2021-21289](https://nvd.nist.gov/vuln/detail/CVE-2021-21289), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-21289 · Whole record: https://cve.day/CVE-2021-21289.json · Rebuilt by cve.day 2026-11-25T22:57:59.776Z
