# Command Injection Vulnerability in Mechanize

Advisory record · `GHSA-qrqm-fpv6-6r8g`

- **Identifiers:** `GHSA-qrqm-fpv6-6r8g` · `CVE-2021-21289`
- **State:** Confirmed
- **Severity:** CVSS 7.4 High
- **Critical:** No
- **Weakness (CWE):** [CWE-78](https://cwe.mitre.org/data/definitions/78.html)
- **Tags:** [Command injection](https://agentprime.io/advisories/tag/command-injection.md)
- **Published:** 2 Feb 2021
- **Updated:** 10 Sept 2026
- **Reviewed by a person:** No

Published by the GitHub Advisory Database at 2 Feb 2021, 18:50 UTC. agentprime has not analysed this yet, so whether it affects any app is not known.

## Affected packages

- `mechanize` (RubyGems): affected `>=2.0.0, <2.7.7`; fixed in `2.7.7`

## Machine-written summary

Summary written by Claude Haiku from the source advisory. Not reviewed by a person.

> Mechanize versions 2.0.0 up to but not including 2.7.7 are vulnerable to OS command injection through several methods that use Ruby's Kernel.open, such as CookieJar#load, Mechanize#download, and File#save. An attacker can exploit this only when untrusted input is passed as a local filename to these calls, allowing them to run operating system commands. Upgrade to Mechanize 2.7.7 or later; the advisory lists no workarounds.

Written 8 Nov 2026.

## Not analysed yet

We haven’t published our analysis of this Advisory yet. Once a person has reviewed it, this page will say what’s vulnerable, what has to be true for your app to be affected, and how to check.

## Severity and exploitation

- 7.4 High, CVSS 3.1: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N`, from CNA (GitHub_M)

- **CISA KEV:** Not listed.
- **EPSS:** 0.035, the 89th percentile, on 9 Nov 2026: FIRST’s estimate of the chance of exploitation in the next 30 days.

## Timeline

- 31 Oct 2026, 15:16 UTC: First seen by agentprime
- 31 Oct 2026, 15:16 UTC: [Confirmed by OSV](https://osv.dev/vulnerability/GHSA-qrqm-fpv6-6r8g)

## Sources

- [GitHub Advisory Database: GHSA-qrqm-fpv6-6r8g](https://github.com/advisories/GHSA-qrqm-fpv6-6r8g)
- [OSV: GHSA-qrqm-fpv6-6r8g](https://osv.dev/vulnerability/GHSA-qrqm-fpv6-6r8g)
- <https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g>
- <https://nvd.nist.gov/vuln/detail/CVE-2021-21289>
- <https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0>
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml>
- <https://github.com/sparklemotion/mechanize>
- <https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7>
- <https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V>
- <https://rubygems.org/gems/mechanize>
- <https://security.gentoo.org/glsa/202107-17>

Facts on this page come from the GitHub Advisory Database (CC-BY 4.0), OSV and the other sources listed, as published. We don’t reproduce full advisory descriptions, which can contain exploit code.

## Check whether this affects you

A Match means an installed version is in the affected range above. Most don’t affect the app; agentprime hasn’t analysed this one yet.

- With the agentprime MCP server (<https://api.agentprime.io/mcp>), ask your agent to check the project: `check_lockfile` sends a lockfile, `check_packages` a list of installed packages, and both return the Matches and the upgrades that clear them. `get_advisory` returns this record. Setup: <https://agentprime.io/mcp.md>
- In a browser: <https://agentprime.io/check/> reads your lockfile in the browser, never uploading it.
- Whether it touches your code, with file and line: the Claude Code plugin, <https://agentprime.io/plugin.md>
- As JSON: <https://api.agentprime.io/v1/advisories/GHSA-qrqm-fpv6-6r8g>, or `POST https://api.agentprime.io/v1/match` with your packages (<https://agentprime.io/api.md>)

---

The web page: <https://agentprime.io/advisories/GHSA-qrqm-fpv6-6r8g/>. Everything for agents: <https://agentprime.io/llms.txt>.
