ubuntu-cve-2021-21289
Vulnerability from osv_ubuntu
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": [
{
"ecosystem_specific": {
"binaries": [
{
"binary_name": "ruby-mechanize",
"binary_version": "2.7.3-1"
}
]
},
"package": {
"ecosystem": "Ubuntu:16.04:LTS",
"name": "ruby-mechanize",
"purl": "pkg:deb/ubuntu/ruby-mechanize@2.7.3-1?arch=source\u0026distro=xenial"
},
"ranges": [
{
"events": [
{
"introduced": "0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.7.3-1"
]
},
{
"ecosystem_specific": {
"binaries": [
{
"binary_name": "ruby-mechanize",
"binary_version": "2.7.5-2"
}
]
},
"package": {
"ecosystem": "Ubuntu:18.04:LTS",
"name": "ruby-mechanize",
"purl": "pkg:deb/ubuntu/ruby-mechanize@2.7.5-2?arch=source\u0026distro=bionic"
},
"ranges": [
{
"events": [
{
"introduced": "0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.7.5-1",
"2.7.5-2"
]
},
{
"ecosystem_specific": {
"binaries": [
{
"binary_name": "ruby-mechanize",
"binary_version": "2.7.6-1"
}
]
},
"package": {
"ecosystem": "Ubuntu:20.04:LTS",
"name": "ruby-mechanize",
"purl": "pkg:deb/ubuntu/ruby-mechanize@2.7.6-1?arch=source\u0026distro=focal"
},
"ranges": [
{
"events": [
{
"introduced": "0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.7.6-1"
]
},
{
"ecosystem_specific": {
"binaries": [
{
"binary_name": "ruby-mechanize",
"binary_version": "2.7.7-3"
}
]
},
"package": {
"ecosystem": "Ubuntu:22.04:LTS",
"name": "ruby-mechanize",
"purl": "pkg:deb/ubuntu/ruby-mechanize@2.7.7-3?arch=source\u0026distro=jammy"
},
"ranges": [
{
"events": [
{
"introduced": "0"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"2.7.7-1",
"2.7.7-3"
]
}
],
"aliases": [],
"details": "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\u0027 methods which implicitly use Ruby\u0027s 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.",
"id": "UBUNTU-CVE-2021-21289",
"modified": "2025-10-24T04:50:06Z",
"published": "2021-02-02T19:15:00Z",
"references": [
{
"type": "REPORT",
"url": "https://ubuntu.com/security/CVE-2021-21289"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/aae0b13514a1a0caf93b1cf233733c50e679069a"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/2ac906b26f4a565a0af92df5fb9c8a36c2b75375"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/f43a3952ab39341136656b0a8b2c8597ba1b4adc"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/b48b12f5db33c5a94a14dfcab8adf3e73cfa0388"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/63f8779e49664d5e95fae8d42d04c8e373162b3c"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0"
},
{
"type": "REPORT",
"url": "https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7"
},
{
"type": "REPORT",
"url": "https://rubygems.org/gems/mechanize/"
},
{
"type": "REPORT",
"url": "https://www.cve.org/CVERecord?id=CVE-2021-21289"
}
],
"related": [],
"schema_version": "1.7.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N",
"type": "CVSS_V3"
},
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "medium",
"type": "Ubuntu"
}
],
"upstream": [
"CVE-2021-21289"
]
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.