CVE-2020-7598
Description
minimist before 1.2.2 could be tricked into adding or modifying properties of Object.prototype using a "constructor" or "__proto__" payload.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Prototype Pollution in minimist <=1.2.1 allows attackers to add or modify Object.prototype properties via constructor or __proto__ keys.
Vulnerability
CVE-2020-7598 is a Prototype Pollution vulnerability in the Node.js package minimist, a popular command-line argument parser. Versions before 1.2.2 fail to filter the __proto__ and constructor properties, allowing an attacker to inject arbitrary properties into Object.prototype. This is a classic prototype pollution pattern where untrusted input reaches a recursive merge or property definition by path [1][3].
Exploitation
An attacker can craft command-line arguments such as --__proto__.x 123 or --constructor.prototype.y 123 to pollute the global object prototype. The exploit does not require authentication, as it only requires the ability to pass arguments to a vulnerable script. In typical scenarios, this could be an unprivileged user invoking a Node.js application that uses minimist to parse command-line arguments [4].
Impact
Successful prototype pollution can lead to denial of service by triggering JavaScript exceptions, or tampering with application logic. In more severe cases, it can cause remote code execution by forcing the application into an attacker-controlled code path [3]. Since all JavaScript objects inherit from Object.prototype, the pollution affects the entire application context.
Mitigation
The issue is fixed in minimist version 1.2.2. Users should upgrade to this version or later. There is no known workaround besides updating the package. OpenSUSE also issued an advisory referencing this CVE [2].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
minimistnpm | < 0.2.1 | 0.2.1 |
minimistnpm | >= 1.0.0, < 1.2.3 | 1.2.3 |
Affected products
57- minimist/minimistdescription
- ghsa-coords56 versionspkg:npm/minimistpkg:rpm/almalinux/nodejs-nodemonpkg:rpm/almalinux/nodejs-packagingpkg:rpm/opensuse/nodejs8&distro=openSUSE%20Leap%2015.1pkg:rpm/suse/branch-network-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/cobbler&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/dhcpd-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/grafana-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/image-sync-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2012pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP1pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP2pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/nodejs12&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2012pkg:rpm/suse/nodejs6&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2012pkg:rpm/suse/nodejs6&distro=SUSE%20OpenStack%20Cloud%207pkg:rpm/suse/nodejs6&distro=SUSE%20OpenStack%20Cloud%20Crowbar%208pkg:rpm/suse/nodejs6&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP1pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP2pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/openvpn-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/patterns-suse-manager&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/patterns-suse-manager&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/prometheus-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/pxe-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/py26-compat-salt&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/python-susemanager-retail&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/saltboot-formula&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-backend&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/spacewalk-backend&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-certs-tools&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/spacewalk-certs-tools&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-client-tools&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/spacewalk-client-tools&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-java&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-proxy-installer&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/spacewalk-utils&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/spacewalk-web&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/spacewalk-web&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-doc-indexes&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-docs_en&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-schema&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-sls&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-tftpsync&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/susemanager-tftpsync-recv&distro=SUSE%20Manager%20Proxy%20Module%204.0pkg:rpm/suse/virtual-host-gatherer&distro=SUSE%20Manager%20Server%20Module%204.0pkg:rpm/suse/virtualization-host-formula&distro=SUSE%20Manager%20Server%20Module%204.0
< 0.2.1+ 55 more
- (no CPE)range: < 0.2.1
- (no CPE)range: < 1.18.3-1.module_el8.3.0+2023+d2377ea3
- (no CPE)range: < 17-3.module_el8.4.0+2224+b07ac28e
- (no CPE)range: < 8.17.0-lp151.2.15.1
- (no CPE)range: < 0.1.1583842676.2fc2fa6-3.13.2
- (no CPE)range: < 3.0.0+git20190806.32c4bae0-7.10.2
- (no CPE)range: < 0.1.1583829431.db6edda-3.11.2
- (no CPE)range: < 0.2-4.7.2
- (no CPE)range: < 0.1.1585064259.12b97ef-3.14.2
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 10.21.0-1.24.1
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 10.21.0-1.21.1
- (no CPE)range: < 12.18.0-1.14.1
- (no CPE)range: < 6.17.1-11.37.1
- (no CPE)range: < 6.17.1-11.37.1
- (no CPE)range: < 6.17.1-11.37.1
- (no CPE)range: < 6.17.1-11.37.1
- (no CPE)range: < 8.17.0-3.32.1
- (no CPE)range: < 8.17.0-3.32.1
- (no CPE)range: < 8.17.0-3.32.1
- (no CPE)range: < 8.17.0-10.3.1
- (no CPE)range: < 8.17.0-3.32.1
- (no CPE)range: < 8.17.0-3.32.1
- (no CPE)range: < 0.1-4.3.1
- (no CPE)range: < 4.0-9.13.2
- (no CPE)range: < 4.0-9.13.2
- (no CPE)range: < 0.2-4.10.2
- (no CPE)range: < 0.1.1586937953.e458f5c-3.14.2
- (no CPE)range: < 2016.11.10-10.14.2
- (no CPE)range: < 1.0.1583842676.2fc2fa6-3.16.2
- (no CPE)range: < 0.1.1587051918.6bc9e88-3.10.2
- (no CPE)range: < 4.0.31-3.26.3
- (no CPE)range: < 4.0.31-3.26.3
- (no CPE)range: < 4.0.16-3.18.2
- (no CPE)range: < 4.0.16-3.18.2
- (no CPE)range: < 4.0.13-3.16.2
- (no CPE)range: < 4.0.13-3.16.2
- (no CPE)range: < 4.0.5-3.3.2
- (no CPE)range: < 4.0.32-3.26.2
- (no CPE)range: < 4.0.12-3.3.2
- (no CPE)range: < 4.0.17-3.18.2
- (no CPE)range: < 4.0.20-3.21.3
- (no CPE)range: < 4.0.20-3.21.3
- (no CPE)range: < 4.0.23-3.23.3
- (no CPE)range: < 4.0-10.21.2
- (no CPE)range: < 4.0-10.21.2
- (no CPE)range: < 4.0.19-3.20.2
- (no CPE)range: < 4.0.25-3.20.2
- (no CPE)range: < 4.0.6-3.3.2
- (no CPE)range: < 4.0.6-3.3.2
- (no CPE)range: < 1.0.20-3.6.2
- (no CPE)range: < 0.3-4.6.2
Patches
43 files changed · +57 −4
index.js+12 −3 modified@@ -175,12 +175,21 @@ function hasKey (obj, keys) { function setKey (obj, keys, value) { var o = obj; - keys.slice(0,-1).forEach(function (key) { + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (key === '__proto__') return; if (o[key] === undefined) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; o = o[key]; - }); - + } + var key = keys[keys.length - 1]; + if (key === '__proto__') return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; if (o[key] === undefined || typeof o[key] === 'boolean') { o[key] = value; }
package.json+1 −1 modified@@ -1,6 +1,6 @@ { "name": "minimist", - "version": "0.2.0", + "version": "0.2.1", "description": "parse argument options", "main": "index.js", "devDependencies": {
test/proto.js+44 −0 added@@ -0,0 +1,44 @@ +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x','123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4,5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x','5','--x.__proto__.z','100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x','abc','--x.__proto__.z','def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y','123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +});
1 file changed · +7 −0
readme.markdown+7 −0 modified@@ -29,6 +29,13 @@ $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz beep: 'boop' } ``` +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 + # methods ``` js
38a4d1caead7even more aggressive checks for protocol pollution
2 files changed · +13 −5
index.js+11 −3 modified@@ -68,13 +68,21 @@ module.exports = function (args, opts) { function setKey (obj, keys, value) { var o = obj; - keys.slice(0,-1).forEach(function (key) { + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (key === '__proto__') return; if (o[key] === undefined) o[key] = {}; - if (o[key] === {}.__proto__) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; o = o[key]; - }); + } var key = keys[keys.length - 1]; + if (key === '__proto__') return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { o[key] = value; }
test/proto.js+2 −2 modified@@ -4,7 +4,7 @@ var test = require('tape'); test('proto pollution', function (t) { var argv = parse(['--__proto__.x','123']); t.equal({}.x, undefined); - t.equal(argv.__proto__.x, 123); + t.equal(argv.__proto__.x, undefined); t.equal(argv.x, undefined); t.end(); }); @@ -14,7 +14,7 @@ test('proto pollution (array)', function (t) { t.equal({}.z, undefined); t.deepEqual(argv.x, [4,5]); t.equal(argv.x.z, undefined); - t.equal(argv.x.__proto__.z, 789); + t.equal(argv.x.__proto__.z, undefined); t.end(); });
63e7ed05aa4bdon't assign onto __proto__
2 files changed · +2 −0
index.js+1 −0 modified@@ -70,6 +70,7 @@ module.exports = function (args, opts) { var o = obj; keys.slice(0,-1).forEach(function (key) { if (o[key] === undefined) o[key] = {}; + if (o[key] === {}.__proto__) o[key] = {}; o = o[key]; });
test/proto.js+1 −0 modified@@ -4,5 +4,6 @@ var test = require('tape'); test('proto pollution', function (t) { var argv = parse(['--__proto__.x','123']); t.equal({}.x, undefined); + t.equal(argv.__proto__.x, 123); t.end(); });
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- lists.opensuse.org/opensuse-security-announce/2020-06/msg00024.htmlghsavendor-advisoryx_refsource_SUSEWEB
- github.com/advisories/GHSA-vh95-rmgr-6w4mghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2020-7598ghsaADVISORY
- github.com/minimistjs/minimist/commit/10bd4cdf49d9686d48214be9d579a9cdfda37c68ghsaWEB
- github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9abghsaWEB
- github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11fghsaWEB
- github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94ghsaWEB
- snyk.io/vuln/SNYK-JS-MINIMIST-559764ghsax_refsource_MISCWEB
- www.npmjs.com/advisories/1179ghsaWEB
News mentions
0No linked articles in our index yet.