Security advisory
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2021-21289
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 1 Nov 2026, 08:39 UTC · Revision 1
Source evidence
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.
osv:CVE-2021-21289
Complete source record
{
"id": "af7396f81b69949e8861178e0ad709de65d89f8f4b10cc39bee7cf4bf3a0ea20",
"url": "https://osv.dev/vulnerability/CVE-2021-21289",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2021-21289",
"summary": "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.",
"evidence": "osv:CVE-2021-21289",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2021-21289",
"aliases": [
"CVE-2021-21289",
"GHSA-qrqm-fpv6-6r8g"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/sparklemotion/mechanize",
"type": "GIT",
"events": [
{
"introduced": "4cf254f24feab5bc8b5195972b984ca45d9c9503"
},
{
"fixed": "3044b4eb6cadc2f0bb7b386b674659de50c0dcfc"
},
{
"fixed": "66a6a1bfa653a5f13274a396a5e5441238656aa0"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:mechanize_project:mechanize:*:*:*:*:*:ruby:*:*",
"range": [
{
"introduced": "2.0"
},
{
"fixed": "2.7.7"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "66a6a1bfa653a5f13274a396a5e5441238656aa0"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "3044b4eb6cadc2f0bb7b386b674659de50c0dcfc"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v2.7.7"
}
]
}
}
],
"versions": [
"v2.7.6",
"v2.7.5",
"v2.7.4",
"v2.7.4.beta3",
"v2.7.4.beta2",
"v2.7.4.beta1",
"v2.7.3",
"v2.7.2",
"v2.7.1",
"v2.7.0",
"v2.6.0",
"v2.5.1",
"v2.5",
"v2.4",
"v2.3",
"v2.2.1",
"v2.2",
"v2.1.1",
"v2.1",
"v2.1.pre.1",
"v2.0.1",
"v2.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-21289.json"
}
}
],
"modified": "2026-10-24T10:48:38.213398164Z",
"provider": "osv",
"references": [
"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://github.com/sparklemotion/mechanize/releases/tag/v2.7.7",
"https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g",
"https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html",
"https://rubygems.org/gems/mechanize/",
"https://security.gentoo.org/glsa/202107-17",
"https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0"
],
"provider_metadata": {
"unresolved_ranges": [
{
"cpes": [
"cpe:2.3:a:mechanize_project:mechanize:*:*:*:*:*:ruby:*:*"
],
"vendor_product": "mechanize_project:mechanize",
"extracted_events": [
{
"range": [
{
"introduced": "2.0"
},
{
"fixed": "2.7.7"
}
],
"source": "CPE_RANGE"
}
]
},
{
"cpes": [
"cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*"
],
"vendor_product": "debian:debian_linux",
"extracted_events": [
{
"range": [
{
"introduced": "9.0"
},
{
"last_affected": "9.0"
}
],
"source": "CPE_STRING"
}
]
},
{
"cpes": [
"cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*",
"cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*"
],
"vendor_product": "fedoraproject:fedora",
"extracted_events": [
{
"range": [
{
"introduced": "32"
},
{
"last_affected": "32"
},
{
"introduced": "33"
},
{
"last_affected": "33"
}
],
"source": "CPE_STRING"
}
]
}
]
}
},
"related_cves": [
{
"value": "CVE-2021-21289",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 441616,
"published_at": "2021-02-02T19:15:14.22+00:00"
}