CVE-2020-7608: Yargs parser Yargs-parser Vulnerable To Prototype Pollution Vulnerability

MODERATE
Advisory Identifier: GHSA-p9pc-299p-vxgp
CVSS 5.3
CWE-1321 CWE-915
Published
Advisory Summary

CVE-2020-7608 is a MODERATE (CVSS 5.3) yargs-parser vulnerable to prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Yargs parser libraries in the npm ecosystem. The issue involves yargs-parser vulnerable to prototype pollution. Remediation is available by upgrading affected packages to version 13.1.2, 15.0.1, 18.1.1, 5.0.1.

CVE-2020-7608 at a Glance

CVE Identifier CVE-2020-7608
GHSA Identifier GHSA-p9pc-299p-vxgp
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Yargs parser
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2020-7608

To remediate this vulnerability, upgrade all affected Yargs parser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

yargs-parser fixed: 13.1.2
npm install yargs-parser@13.1.2
yargs-parser fixed: 15.0.1
npm install yargs-parser@15.0.1
yargs-parser fixed: 18.1.1
npm install yargs-parser@18.1.1
yargs-parser fixed: 5.0.1
npm install yargs-parser@5.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls yargs-parser

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2020-7608, inspect your project dependencies using npm:

npm ls yargs-parser

Analyze the terminal output to locate any version of Yargs parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 13.1.2), your application is affected.

Note: The npm ls yargs-parser command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Yargs parser, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Affected versions of `yargs-parser` are vulnerable to prototype pollution. Arguments are not properly sanitized, allowing an attacker to modify the prototype of `Object`, causing the addition or modification of an existing property that will exist on all objects. Parsing the argument `--foo.__proto__.bar baz'` adds a `bar` property with value `baz` to all objects. This is only exploitable if attackers have control over the arguments being passed to `yargs-parser`. ## Recommendation Upgrade to versions 13.1.2, 15.0.1, 18.1.1 or later.

CVE-2020-7608 Affected Yargs parser Versions

4 component(s)
Fixed Versions:
13.1.215.0.118.1.15.0.1
Product / Package Ecosystem Affected Versions Fixed Version
yargs-parser
npm
≥ 6.0.0
< 13.1.2
13.1.2
yargs-parser
npm
≥ 14.0.0
< 15.0.1
15.0.1
yargs-parser
npm
≥ 16.0.0
< 18.1.1
18.1.1
yargs-parser
npm
< 5.0.1
5.0.1

References

Frequently Asked Questions

What is CVE-2020-7608?
CVE-2020-7608 is a security vulnerability in Yargs parser involving yargs-parser Vulnerable to Prototype Pollution under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Yargs parser versions are affected?
Affected versions include releases prior to 13.1.2, 15.0.1, 18.1.1, 5.0.1 across affected packages: yargs-parser.
What version fixes CVE-2020-7608?
Upgrading to 13.1.2, 15.0.1, 18.1.1, 5.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is yargs-parser affected?
Yes, yargs-parser is affected in releases prior to 13.1.2, 15.0.1, 18.1.1, 5.0.1. Upgrade your dependency to 13.1.2, 15.0.1, 18.1.1, 5.0.1 or later.
What is the CVSS score of CVE-2020-7608?
CVE-2020-7608 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2020-7608?
CVE-2020-7608 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2020-7608?
Run the dependency tree command: 'npm ls yargs-parser'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p9pc-299p-vxgp",
  "modified" : "2022-08-02T21:44:02Z",
  "published" : "2020-09-04T18:00:54Z",
  "aliases" : [ "CVE-2020-7608" ],
  "summary" : "yargs-parser Vulnerable to Prototype Pollution",
  "details" : "Affected versions of `yargs-parser` are vulnerable to prototype pollution. Arguments are not properly sanitized, allowing an attacker to modify the prototype of `Object`, causing the addition or modification of an existing property that will exist on all objects.  \nParsing the argument `--foo.__proto__.bar baz'` adds a `bar` property with value `baz` to all objects. This is only exploitable if attackers have control over the arguments being passed to `yargs-parser`.\n\n\n\n## Recommendation\n\nUpgrade to versions 13.1.2, 15.0.1, 18.1.1 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "yargs-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "13.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "yargs-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "14.0.0"
      }, {
        "fixed" : "15.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "yargs-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "16.0.0"
      }, {
        "fixed" : "18.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "yargs-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.0.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.0.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7608"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/yargs-parser/commit/1c417bd0b42b09c475ee881e36d292af4fa2cc36"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/yargs/yargs-parser"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-YARGSPARSER-560381"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1500"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-915" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T19:01:32Z",
    "nvd_published_at" : "2020-03-16T20:15:00Z"
  }
}