{"schemaVersion":3,"id":"CVE-2021-21289","aliases":["MGASA-2021-0124","UBUNTU-CVE-2021-21289","DEBIAN-CVE-2021-21289","DLA-2561-1","GHSA-qrqm-fpv6-6r8g"],"status":"published","duplicateOf":null,"title":"Command Injection Vulnerability in Mechanize","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.","dates":{"published":"2021-02-02T18:50:13.000Z","modified":"2024-08-03T18:09:15.157Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":8.3,"severity":"high","version":"3.1","versionLabel":"v3.1","source":"NVD","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":7.4,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Ubuntu","score":8.3,"severity":"high","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H","exploitability":4.1,"impact":10,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Debian","score":8.3,"severity":"high","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H","exploitability":4.1,"impact":10,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Rubygems","score":7.4,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N","exploitability":7.2,"impact":6.7,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":8.3,"severity":"high","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false},{"version":"2.0","versionLabel":"v2.0","source":"NVD","score":7.6,"severity":"high","vector":"AV:N/AC:H/Au:N/C:C/I:C/A:C","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.03507,"percentile":0.89126,"severity":"low","asOf":"2026-10-22T00:00:00.000Z","change":{"pp":0,"baselineDate":"2026-09-22T00:00:00.000Z","baselineScore":0.03507},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-21T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-22T00:00:00.000Z","score":0.03507,"percentile":0.89126}],"last30":[{"date":"2026-09-22T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-21T00:00:00.000Z","score":0.03507,"percentile":null},{"date":"2026-10-22T00:00:00.000Z","score":0.03507,"percentile":0.89126}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-78","name":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')","description":"The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.","type":"weakness","status":"Stable","abstraction":"Base","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/78.html"}],"affected":[{"vendor":"debian","product":"ruby-mechanize","name":"ruby-mechanize","label":"ruby-mechanize","ecosystem":"Debian","cpePart":null,"purl":"pkg:deb/debian/ruby-mechanize","purlType":"deb","versions":[{"text":"< 2.7.5-1+deb9u1","noFixRecorded":false,"fixedIn":null},{"text":"< 2.7.7-1","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.7.5-1+deb9u1 | < 2.7.7-1","eol":null,"hubHref":null},{"vendor":"ubuntu","product":"ruby-mechanize","name":"ruby-mechanize","label":"ruby-mechanize","ecosystem":"Ubuntu","cpePart":null,"purl":"pkg:deb/ubuntu/ruby-mechanize","purlType":"deb","versions":[{"text":"All versions","noFixRecorded":true,"fixedIn":null}],"versionsText":"All versions (No fix recorded)","eol":null,"hubHref":null},{"vendor":"debian","product":"debian_linux","name":"debian linux","label":"debian_linux","ecosystem":null,"cpePart":"o","purl":null,"purlType":null,"versions":[{"text":"9.0","noFixRecorded":false,"fixedIn":null}],"versionsText":"9.0","eol":{"isEol":true,"eolDate":"2022-07-01T00:00:00.000Z","matchMethod":"cpe","cycle":{"name":"9","label":"9 (Stretch)","eolFrom":"2022-07-01T00:00:00.000Z","isLts":false,"isMaintained":true,"latestVersion":"9.13"},"product":{"name":"debian","label":"Debian","category":"os"}},"hubHref":"/vendor/debian/debian_linux"},{"vendor":"fedoraproject","product":"fedora","name":"fedora","label":"fedora","ecosystem":null,"cpePart":"o","purl":null,"purlType":null,"versions":[{"text":"32","noFixRecorded":false,"fixedIn":null},{"text":"33","noFixRecorded":false,"fixedIn":null}],"versionsText":"32 | 33","eol":{"isEol":true,"eolDate":"2021-05-25T00:00:00.000Z","matchMethod":"cpe","cycle":{"name":"32","label":"32","eolFrom":"2021-05-25T00:00:00.000Z","isLts":false,"isMaintained":false,"latestVersion":null},"product":{"name":"fedora","label":"Fedora Linux","category":"os"}},"hubHref":"/vendor/fedoraproject/fedora"},{"vendor":"RubyGems","product":"mechanize","name":"mechanize","label":"mechanize","ecosystem":"RubyGems","cpePart":null,"purl":"pkg:gem/mechanize","purlType":"gem","versions":[{"text":"≥ 2.0.0, < 2.7.7","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 2.0.0, < 2.7.7","eol":null,"hubHref":null},{"vendor":"mageia","product":"ruby-mechanize","name":"ruby-mechanize","label":"ruby-mechanize","ecosystem":"Mageia","cpePart":null,"purl":"pkg:rpm/mageia/ruby-mechanize","purlType":"rpm","versions":[{"text":"< 2.7.6-2.1.mga7","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.7.6-2.1.mga7","eol":null,"hubHref":null},{"vendor":"mageia","product":"ruby-mechanize","name":"ruby-mechanize","label":"ruby-mechanize","ecosystem":"Mageia","cpePart":null,"purl":"pkg:rpm/mageia/ruby-mechanize","purlType":"rpm","versions":[{"text":"< 2.7.6-3.1.mga8","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.7.6-3.1.mga8","eol":null,"hubHref":null},{"vendor":"mechanize_project","product":"mechanize","name":"mechanize","label":"mechanize","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 2.0, < 2.7.7","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 2.0, < 2.7.7","eol":null,"hubHref":"/vendor/mechanize_project/mechanize"},{"vendor":"sparklemotion","product":"mechanize","name":"mechanize","label":"mechanize","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"≥ 2.0, < 2.7.7","noFixRecorded":false,"fixedIn":null}],"versionsText":"≥ 2.0, < 2.7.7","eol":null,"hubHref":"/vendor/sparklemotion/mechanize"}],"affectedCount":9,"eol":{"hasEol":true,"count":2},"references":[{"url":"https://github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g","label":"github.com/sparklemotion/mechanize/security/advisories/GHSA-qrqm-fpv6-6r8g","hostname":"github.com","tags":["X Refsource CONFIRM","REPORT","WEB","Third Party Advisory"]},{"url":"https://rubygems.org/gems/mechanize/","label":"rubygems.org/gems/mechanize/","hostname":"rubygems.org","tags":["X Refsource MISC","REPORT","Product","Third Party Advisory"]},{"url":"https://github.com/sparklemotion/mechanize/releases/tag/v2.7.7","label":"github.com/sparklemotion/mechanize/releases/tag/v2.7.7","hostname":"github.com","tags":["X Refsource MISC","REPORT","WEB","Release Notes","Third Party Advisory"]},{"url":"https://github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0","label":"github.com/sparklemotion/mechanize/commit/66a6a1bfa653a5f13274a396a5e5441238656aa0","hostname":"github.com","tags":["X Refsource MISC","REPORT","WEB","Patch","Third Party Advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV/","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["Vendor Advisory","X Refsource FEDORA"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V/","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["Vendor Advisory","X Refsource FEDORA"]},{"url":"https://lists.debian.org/debian-lts-announce/2021/02/msg00021.html","label":"lists.debian.org/debian-lts-announce/2021/02/msg00021.html","hostname":"lists.debian.org","tags":["Mailing List","X Refsource MLIST","WEB","Third Party Advisory"]},{"url":"https://security.gentoo.org/glsa/202107-17","label":"security.gentoo.org/glsa/202107-17","hostname":"security.gentoo.org","tags":["Vendor Advisory","X Refsource GENTOO","WEB","Third Party Advisory"]},{"url":"https://advisories.mageia.org/MGASA-2021-0124.html","label":"advisories.mageia.org/MGASA-2021-0124.html","hostname":"advisories.mageia.org","tags":["Advisory"]},{"url":"https://bugs.mageia.org/show_bug.cgi?id=28448","label":"bugs.mageia.org/show_bug.cgi?id=28448","hostname":"bugs.mageia.org","tags":["REPORT"]},{"url":"https://www.debian.org/lts/security/2021/dla-2561","label":"www.debian.org/lts/security/2021/dla-2561","hostname":"www.debian.org","tags":["WEB"]},{"url":"https://ubuntu.com/security/CVE-2021-21289","label":"ubuntu.com/security/CVE-2021-21289","hostname":"ubuntu.com","tags":["REPORT"]},{"url":"https://github.com/sparklemotion/mechanize/commit/aae0b13514a1a0caf93b1cf233733c50e679069a","label":"github.com/sparklemotion/mechanize/commit/aae0b13514a1a0caf93b1cf233733c50e679069a","hostname":"github.com","tags":["REPORT"]},{"url":"https://github.com/sparklemotion/mechanize/commit/2ac906b26f4a565a0af92df5fb9c8a36c2b75375","label":"github.com/sparklemotion/mechanize/commit/2ac906b26f4a565a0af92df5fb9c8a36c2b75375","hostname":"github.com","tags":["REPORT"]},{"url":"https://github.com/sparklemotion/mechanize/commit/f43a3952ab39341136656b0a8b2c8597ba1b4adc","label":"github.com/sparklemotion/mechanize/commit/f43a3952ab39341136656b0a8b2c8597ba1b4adc","hostname":"github.com","tags":["REPORT"]},{"url":"https://github.com/sparklemotion/mechanize/commit/b48b12f5db33c5a94a14dfcab8adf3e73cfa0388","label":"github.com/sparklemotion/mechanize/commit/b48b12f5db33c5a94a14dfcab8adf3e73cfa0388","hostname":"github.com","tags":["REPORT"]},{"url":"https://github.com/sparklemotion/mechanize/commit/63f8779e49664d5e95fae8d42d04c8e373162b3c","label":"github.com/sparklemotion/mechanize/commit/63f8779e49664d5e95fae8d42d04c8e373162b3c","hostname":"github.com","tags":["REPORT"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-21289","label":"www.cve.org/CVERecord?id=CVE-2021-21289","hostname":"www.cve.org","tags":["REPORT"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-21289","label":"security-tracker.debian.org/tracker/CVE-2021-21289","hostname":"security-tracker.debian.org","tags":["Advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21289","label":"nvd.nist.gov/vuln/detail/CVE-2021-21289","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml","label":"github.com/rubysec/ruby-advisory-db/blob/master/gems/mechanize/CVE-2021-21289.yml","hostname":"github.com","tags":["WEB"]},{"url":"https://github.com/sparklemotion/mechanize","label":"github.com/sparklemotion/mechanize","hostname":"github.com","tags":["PACKAGE"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LBVVJUL4P4KCJH4IQTHFZ4ATXY7XXZPV","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["WEB"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/YNFZ7ROYS6V4J5L5PRAJUG2AWC7VXR2V","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["WEB"]},{"url":"https://rubygems.org/gems/mechanize","label":"rubygems.org/gems/mechanize","hostname":"rubygems.org","tags":["WEB"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2021-02-02T18:50:13.000Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2024-08-03T18:09:15.157Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"risk":{"score":34,"level":"medium","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-22T17:21:18.125Z","stale":false,"partial":false}}