Prototype Pollution
Description
The package y18n before 3.2.2, 4.0.1 and 5.0.5, is vulnerable to Prototype Pollution.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
The y18n package before versions 3.2.2, 4.0.1, and 5.0.5 is vulnerable to Prototype Pollution, allowing potential RCE or DoS.
Vulnerability
Overview
The y18n npm package, a utility used by yargs for internationalization, is vulnerable to Prototype Pollution before versions 3.2.2, 4.0.1, and 5.0.5 [1][2]. Prototype Pollution occurs when an attacker manipulates a JavaScript object's prototype—typically via __proto__, constructor, or prototype attributes—to inject arbitrary properties into the base Object.prototype [3]. These injected properties are then inherited by all objects in the application, altering expected behavior.
Attack
Vector and Exploitation
Prototype Pollution in y18n can be triggered through unsafe recursive merge operations or property definition by path [3][4]. In a typical attack, the library processes user-controlled input that contains a malicious __proto__ property. When y18n recursively copies properties from the input object into a target, it does not properly block prototype keys. This flaw allows an attacker to pollute the global object prototype by merging nested __proto__ objects, as described in the Snyk advisory [3]. No authentication is required for exploitation, and the attack surface is increased in any application that uses y18n to handle untrusted configuration or arguments.
Impact
Successful exploitation can lead to Denial of Service (DoS) by causing JavaScript exceptions, or, more critically, Remote Code Execution (RCE) by forcing the application into a code path controlled by the attacker [3][4]. Polluting Object.prototype can override property definitions used by the application logic, eventually enabling arbitrary script execution.
Mitigation
Users should upgrade y18n to version 3.2.2, 4.0.1, or 5.0.5 or later [1][2]. No workaround exists beyond patching the dependency. The vulnerability has been fixed in the referenced versions, and the fix disallows assignment to prototype properties during the merge process.
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 |
|---|---|---|
y18nnpm | < 3.2.2 | 3.2.2 |
y18nnpm | >= 4.0.0, < 4.0.1 | 4.0.1 |
y18nnpm | >= 5.0.0, < 5.0.5 | 5.0.5 |
Affected products
62- y18n/y18ndescription
- ghsa-coords61 versionspkg:npm/y18npkg:rpm/almalinux/nodejs-nodemonpkg:rpm/almalinux/nodejs-packagingpkg:rpm/opensuse/nodejs10&distro=openSUSE%20Leap%2015.2pkg:rpm/opensuse/nodejs10&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/nodejs12&distro=openSUSE%20Leap%2015.2pkg:rpm/opensuse/nodejs12&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/nodejs14&distro=openSUSE%20Leap%2015.2pkg:rpm/opensuse/nodejs14&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/nodejs14&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/nodejs8&distro=openSUSE%20Leap%2015.2pkg:rpm/opensuse/nodejs8&distro=openSUSE%20Leap%2015.3pkg:rpm/suse/nodejs10&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg: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%20SP2pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/nodejs10&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/nodejs10&distro=SUSE%20Manager%20Proxy%204.0pkg:rpm/suse/nodejs10&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.0pkg:rpm/suse/nodejs10&distro=SUSE%20Manager%20Server%204.0pkg:rpm/suse/nodejs12&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2012pkg:rpm/suse/nodejs12&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP2pkg:rpm/suse/nodejs12&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP3pkg:rpm/suse/nodejs14&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2012pkg:rpm/suse/nodejs14&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP2pkg:rpm/suse/nodejs14&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP3pkg:rpm/suse/nodejs8&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg: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%20SP2pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/nodejs8&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/nodejs8&distro=SUSE%20Manager%20Proxy%204.0pkg:rpm/suse/nodejs8&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.0pkg:rpm/suse/nodejs8&distro=SUSE%20Manager%20Server%204.0pkg:rpm/suse/nodejs-common&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Web%20and%20Scripting%2015%20SP2pkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/nodejs-common&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/nodejs-common&distro=SUSE%20Manager%20Proxy%204.0pkg:rpm/suse/nodejs-common&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.0pkg:rpm/suse/nodejs-common&distro=SUSE%20Manager%20Server%204.0
< 3.2.2+ 60 more
- (no CPE)range: < 3.2.2
- (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: < 10.24.1-lp152.2.15.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 12.22.2-lp152.3.15.1
- (no CPE)range: < 12.22.2-4.16.1
- (no CPE)range: < 14.17.2-lp152.11.1
- (no CPE)range: < 14.17.2-5.12.1
- (no CPE)range: < 14.17.5-1.2
- (no CPE)range: < 8.17.0-lp152.3.14.1
- (no CPE)range: < 8.17.0-10.12.2
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.39.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 10.24.1-1.36.1
- (no CPE)range: < 12.22.2-1.32.1
- (no CPE)range: < 12.22.2-4.16.1
- (no CPE)range: < 12.22.2-4.16.1
- (no CPE)range: < 14.17.2-6.12.1
- (no CPE)range: < 14.17.2-5.12.1
- (no CPE)range: < 14.17.2-5.12.1
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-10.12.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 8.17.0-3.47.2
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
- (no CPE)range: < 2.0-3.2.1
Patches
24 files changed · +26 −2
CHANGELOG.md+6 −0 added@@ -0,0 +1,6 @@ +### 3.2.2 (2021-01-04) + + +### Bug Fixes + +* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25))
index.js+1 −1 modified@@ -11,7 +11,7 @@ function Y18N (opts) { this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true // internal stuff. - this.cache = {} + this.cache = Object.create(null) this.writeQueue = [] }
package.json+1 −1 modified@@ -1,6 +1,6 @@ { "name": "y18n", - "version": "3.2.1", + "version": "3.2.2", "description": "the bare-bones internationalization library used by yargs", "main": "index.js", "scripts": {
test/y18n-test.js+18 −0 modified@@ -336,6 +336,24 @@ describe('y18n', function () { }) }) + // See: https://github.com/yargs/y18n/issues/96, + // https://github.com/yargs/y18n/pull/107 + describe('prototype pollution', function () { + it('does not pollute prototype, with __proto__ locale', function () { + const y = y18n() + y.setLocale('__proto__') + y.updateLocale({ polluted: '👽' }) + y.__('polluted').should.equal('👽') + ;(typeof polluted).should.equal('undefined') + }) + + it('does not pollute prototype, when __ is used with __proto__ locale', function () { + const __ = y18n({ locale: '__proto__' }).__ + __('hello') + ;(typeof {}.hello).should.equal('undefined') + }) + }) + after(function () { rimraf.sync('./test/locales/fr.json') })
a9ac604abf75fix: address prototype pollution issue (#108)
2 files changed · +19 −1
lib/index.ts+1 −1 modified@@ -47,7 +47,7 @@ class Y18N { this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true // internal stuff. - this.cache = {} + this.cache = Object.create(null) this.writeQueue = [] }
test/y18n-test.cjs+18 −0 modified@@ -351,6 +351,24 @@ describe('y18n', function () { }) }) + // See: https://github.com/yargs/y18n/issues/96, + // https://github.com/yargs/y18n/pull/107 + describe('prototype pollution', () => { + it('does not pollute prototype, with __proto__ locale', () => { + const y = y18n() + y.setLocale('__proto__') + y.updateLocale({ polluted: '👽' }) + y.__('polluted').should.equal('👽') + ;(typeof polluted).should.equal('undefined') + }) + + it('does not pollute prototype, when __ is used with __proto__ locale', () => { + const __ = y18n({ locale: '__proto__' }).__ + __('hello') + ;(typeof {}.hello).should.equal('undefined') + }) + }) + after(function () { rimraf.sync('./test/locales/fr.json') })
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
10- github.com/advisories/GHSA-c4w7-xm78-47vhghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2020-7774ghsaADVISORY
- cert-portal.siemens.com/productcert/pdf/ssa-389290.pdfghsaWEB
- github.com/yargs/y18n/commit/90401eea9062ad498f4f792e3fff8008c4c193a3ghsaWEB
- github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25ghsaWEB
- github.com/yargs/y18n/issues/96ghsaWEB
- github.com/yargs/y18n/pull/108ghsaWEB
- snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1038306ghsaWEB
- snyk.io/vuln/SNYK-JS-Y18N-1021887ghsaWEB
- www.oracle.com/security-alerts/cpuApr2021.htmlghsaWEB
News mentions
0No linked articles in our index yet.