CVE-2020-7774: Y18n Prototype Pollution Vulnerability

HIGH
Advisory Identifier: GHSA-c4w7-xm78-47vh
CVSS 7.3
CWE-1321 CWE-20 CWE-915
Published
Advisory Summary

CVE-2020-7774 is a HIGH (CVSS 7.3) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Y18n libraries in the npm ecosystem. The issue involves prototype pollution in y18n. Remediation is available by upgrading affected packages to version 3.2.2, 4.0.1, 5.0.5.

CVE-2020-7774 at a Glance

CVE Identifier CVE-2020-7774
GHSA Identifier GHSA-c4w7-xm78-47vh
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Y18n
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.3

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
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-7774

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

y18n fixed: 3.2.2
npm install y18n@3.2.2
y18n fixed: 4.0.1
npm install y18n@4.0.1
y18n fixed: 5.0.5
npm install y18n@5.0.5
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 y18n

How to Check if You Are Affected

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

npm ls y18n

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

Note: The npm ls y18n 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 Y18n, 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

### Overview The npm package `y18n` before versions 3.2.2, 4.0.1, and 5.0.5 is vulnerable to Prototype Pollution. ### POC ```js const y18n = require('y18n')(); y18n.setLocale('__proto__'); y18n.updateLocale({polluted: true}); console.log(polluted); // true ``` ### Recommendation Upgrade to version 3.2.2, 4.0.1, 5.0.5 or later.

CVE-2020-7774 Affected Y18n Versions

3 component(s)
Fixed Versions:
3.2.24.0.15.0.5
Product / Package Ecosystem Affected Versions Fixed Version
y18n
npm
< 3.2.2
3.2.2
y18n
npm
≥ 4.0.0
< 4.0.1
All 1 versions
4.0.0
4.0.1
y18n
npm
≥ 5.0.0
< 5.0.5
5.0.5

References

Frequently Asked Questions

What is CVE-2020-7774?
CVE-2020-7774 is a security vulnerability in Y18n involving Prototype Pollution in y18n under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Y18n versions are affected?
Affected versions include releases prior to 3.2.2, 4.0.1, 5.0.5 across affected packages: y18n.
What version fixes CVE-2020-7774?
Upgrading to 3.2.2, 4.0.1, 5.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is y18n affected?
Yes, y18n is affected in releases prior to 3.2.2, 4.0.1, 5.0.5. Upgrade your dependency to 3.2.2, 4.0.1, 5.0.5 or later.
What is the CVSS score of CVE-2020-7774?
CVE-2020-7774 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2020-7774?
CVE-2020-7774 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-7774?
Run the dependency tree command: 'npm ls y18n'. 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-c4w7-xm78-47vh",
  "modified" : "2023-09-07T20:22:08Z",
  "published" : "2021-03-29T16:05:12Z",
  "aliases" : [ "CVE-2020-7774" ],
  "summary" : "Prototype Pollution in y18n",
  "details" : "### Overview\n\nThe npm package `y18n` before versions 3.2.2, 4.0.1, and 5.0.5 is vulnerable to Prototype Pollution. \n\n### POC\n\n```js\nconst y18n = require('y18n')();\n\ny18n.setLocale('__proto__');\ny18n.updateLocale({polluted: true});\n\nconsole.log(polluted); // true\n```\n\n### Recommendation\n\nUpgrade to version 3.2.2, 4.0.1, 5.0.5 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "y18n"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "y18n"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.1"
      } ]
    } ],
    "versions" : [ "4.0.0" ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "y18n"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7774"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/y18n/issues/96"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/y18n/pull/108"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/y18n/commit/90401eea9062ad498f4f792e3fff8008c4c193a3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/yargs/y18n"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1038306"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-Y18N-1021887"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuApr2021.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321", "CWE-20", "CWE-915" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-12T21:23:11Z",
    "nvd_published_at" : "2020-11-17T13:15:00Z"
  }
}