CWE-1321
AllowedImproperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Abstraction: Variant · Status: Incomplete
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.
855 vulnerabilities reference this CWE, most recent first.
GHSA-JG82-XH3W-RHXX
Vulnerability from github – Published: 2023-10-18 18:27 – Updated: 2025-07-22 15:37Impact
A __proto__ pollution vulnerability exists in synchrony versions before v2.4.4. Successful exploitation could lead to arbitrary code execution.
Summary
A __proto__ pollution vulnerability exists in the LiteralMap transformer allowing crafted input to modify properties in the Object prototype.
When executing in Node.js, due to use of the prettier module, defining a parser property on __proto__ with a path to a JS module on disk causes a require of the value which can lead to arbitrary code execution.
Patch
A fix has been released in deobfuscator@2.4.4.
Mitigation
- Upgrade synchrony to v2.4.4
- Launch node with the --disable-proto=delete or --disable-proto=throw flag
Proof of Concept
Craft a malicious input file named poc.js as follows:
// Malicious code to be run after this file is imported. Logs the result of shell command "dir" to the console.
console.log(require('child_process').execSync('dir').toString())
// Synchrony exploit PoC
{
var __proto__ = { parser: 'poc.js' }
}
Then, run synchrony poc.js from the same directory as the malicious file.
Credits
This vulnerability was found and disclosed by William Khem-Marquez.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "deobfuscator"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.1"
},
{
"fixed": "2.4.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2023-45811"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2023-10-18T18:27:13Z",
"nvd_published_at": "2023-10-17T23:15:12Z",
"severity": "HIGH"
},
"details": "### Impact\n\nA `__proto__` pollution vulnerability exists in synchrony versions before v2.4.4. Successful exploitation could lead to arbitrary code execution.\n\n### Summary\n\nA `__proto__` pollution vulnerability exists in the [LiteralMap] transformer allowing crafted input to modify properties in the Object prototype.\n\nWhen executing in Node.js, due to use of the `prettier` module, defining a `parser` property on `__proto__` with a path to a JS module on disk [causes a `require` of the value][prettier/src/main/parser.js] which can lead to arbitrary code execution.\n\n### Patch\n\nA fix has been released in `deobfuscator@2.4.4`.\n\n### Mitigation\n\n- Upgrade synchrony to v2.4.4\n- Launch node with the [--disable-proto=delete][disable-proto] or [--disable-proto=throw][disable-proto] flag\n\n### Proof of Concept\n\nCraft a malicious input file named `poc.js` as follows:\n\n```js\n// Malicious code to be run after this file is imported. Logs the result of shell command \"dir\" to the console.\nconsole.log(require(\u0027child_process\u0027).execSync(\u0027dir\u0027).toString())\n\n// Synchrony exploit PoC\n{\n var __proto__ = { parser: \u0027poc.js\u0027 }\n}\n```\n\nThen, run `synchrony poc.js` from the same directory as the malicious file.\n\n### Credits\n\nThis vulnerability was found and disclosed by [William Khem-Marquez][SteakEnthusiast].\n\n[LiteralMap]: src/transformers/literalmap.ts\n[SteakEnthusiast]: https://github.com/SteakEnthusiast\n[disable-proto]: https://nodejs.dev/en/api/v20/cli/#--disable-protomode\n[prettier/src/main/parser.js]: https://github.com/prettier/prettier/blob/2.5.1/src/main/parser.js#L53-L63",
"id": "GHSA-jg82-xh3w-rhxx",
"modified": "2025-07-22T15:37:30Z",
"published": "2023-10-18T18:27:13Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/relative/synchrony/security/advisories/GHSA-jg82-xh3w-rhxx"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-45811"
},
{
"type": "WEB",
"url": "https://github.com/relative/synchrony/commit/b583126be94c4db7c5a478f1c5204bfb4162cf40"
},
{
"type": "PACKAGE",
"url": "https://github.com/relative/synchrony"
},
{
"type": "WEB",
"url": "https://github.com/relative/synchrony/security/advisories/src/transformers/literalmap.ts"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Synchrony deobfuscator prototype pollution vulnerability leading to arbitrary code execution"
}
GHSA-JG8V-48H5-WGXG
Vulnerability from github – Published: 2021-08-10 16:02 – Updated: 2023-09-12 19:23This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g __proto__, toString, etc) results in a returned object with a modified prototype instance.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "jszip"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.0"
},
{
"fixed": "3.7.0"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "jszip"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.7.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2021-23413"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2021-08-02T22:15:49Z",
"nvd_published_at": "2021-07-25T13:15:00Z",
"severity": "MODERATE"
},
"details": "This affects the package jszip before 3.7.0. Crafting a new zip file with filenames set to Object prototype values (e.g `__proto__`, `toString`, etc) results in a returned object with a modified prototype instance.",
"id": "GHSA-jg8v-48h5-wgxg",
"modified": "2023-09-12T19:23:56Z",
"published": "2021-08-10T16:02:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-23413"
},
{
"type": "WEB",
"url": "https://github.com/Stuk/jszip/pull/766"
},
{
"type": "WEB",
"url": "https://github.com/Stuk/jszip/commit/22357494f424178cb416cdb7d93b26dd4f824b36"
},
{
"type": "PACKAGE",
"url": "https://github.com/Stuk/jszip"
},
{
"type": "WEB",
"url": "https://github.com/Stuk/jszip/blob/master/lib/object.js%23L88"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARS-1251499"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1251498"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JS-JSZIP-1251497"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "jszip Vulnerable to Prototype Pollution"
}
GHSA-JGPQ-G82G-6C39
Vulnerability from github – Published: 2020-04-07 15:52 – Updated: 2021-07-28 23:16confinit through 0.3.0 is vulnerable to Prototype Pollution.The 'setDeepProperty' function could be tricked into adding or modifying properties of 'Object.prototype' using a 'proto' payload.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "confinit"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2020-7638"
],
"database_specific": {
"cwe_ids": [
"CWE-1321",
"CWE-915"
],
"github_reviewed": true,
"github_reviewed_at": "2020-04-07T15:51:51Z",
"nvd_published_at": "2020-04-06T13:15:00Z",
"severity": "MODERATE"
},
"details": "confinit through 0.3.0 is vulnerable to Prototype Pollution.The \u0027setDeepProperty\u0027 function could be tricked into adding or modifying properties of \u0027Object.prototype\u0027 using a \u0027__proto__\u0027 payload.",
"id": "GHSA-jgpq-g82g-6c39",
"modified": "2021-07-28T23:16:44Z",
"published": "2020-04-07T15:52:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-7638"
},
{
"type": "WEB",
"url": "https://github.com/davideicardi/confinit/commit/a34e06ca5c1c8b047ef112ef188b2fe30d2a1eab"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JS-CONFINIT-564433"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "confinit vulnerable to prototype pollution"
}
GHSA-JH2M-J8PP-55RC
Vulnerability from github – Published: 2021-05-06 18:12 – Updated: 2021-05-05 18:26All versions of package gedi up to and including version 1.6.3 are vulnerable to Prototype Pollution via the set function.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "gedi"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "1.6.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2020-7727"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2021-05-05T18:26:34Z",
"nvd_published_at": "2020-09-01T10:15:00Z",
"severity": "CRITICAL"
},
"details": "All versions of package gedi up to and including version 1.6.3 are vulnerable to Prototype Pollution via the set function.",
"id": "GHSA-jh2m-j8pp-55rc",
"modified": "2021-05-05T18:26:34Z",
"published": "2021-05-06T18:12:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-7727"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JS-GEDI-598803"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Prototype Pollution in gedi"
}
GHSA-JHCC-GW3Q-F4PC
Vulnerability from github – Published: 2026-08-20 21:31 – Updated: 2026-08-20 21:31Improper input validation in the Time Series Visual Builder (TSVB) plugin in OpenSearch Dashboards allows an authenticated remote user to execute arbitrary code on the server via a crafted JSON payload to the metrics visualization API endpoint. This issue is a form of prototype pollution that enables remote code execution.
To remediate this issue, users should upgrade to OpenSearch Dashboards 3.8 or later.
{
"affected": [],
"aliases": [
"CVE-2026-18420"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-20T21:17:06Z",
"severity": "HIGH"
},
"details": "Improper input validation in the Time Series Visual Builder (TSVB) plugin in OpenSearch Dashboards allows an authenticated remote user to execute arbitrary code on the server via a crafted JSON payload to the metrics visualization API endpoint. This issue is a form of prototype pollution that enables remote code execution.\u00a0\n\n\n\nTo remediate this issue, users should upgrade to OpenSearch Dashboards 3.8 or later.",
"id": "GHSA-jhcc-gw3q-f4pc",
"modified": "2026-08-20T21:31:29Z",
"published": "2026-08-20T21:31:29Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/opensearch-project/OpenSearch-Dashboards/security/advisories/GHSA-xmqx-xq2p-8jq2"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-18420"
},
{
"type": "WEB",
"url": "https://aws.amazon.com/security/security-bulletins/2026-085-aws"
},
{
"type": "WEB",
"url": "https://github.com/opensearch-project/OpenSearch-Dashboards/releases/tag/3.8.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-JJ58-488V-4RGF
Vulnerability from github – Published: 2024-06-17 18:31 – Updated: 2024-08-02 15:50almela obx before v.0.0.4 has a Prototype Pollution issue which allows arbitrary code execution via the obx/build/index.js:656), reduce (@almela/obx/build/index.js:470), Object.set (obx/build/index.js:269) component.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@almela/obx"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.0.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-36573"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2024-06-17T22:29:47Z",
"nvd_published_at": "2024-06-17T16:15:14Z",
"severity": "CRITICAL"
},
"details": "almela obx before v.0.0.4 has a Prototype Pollution issue which allows arbitrary code execution via the obx/build/index.js:656), reduce (@almela/obx/build/index.js:470), Object.set (obx/build/index.js:269) component.",
"id": "GHSA-jj58-488v-4rgf",
"modified": "2024-08-02T15:50:03Z",
"published": "2024-06-17T18:31:33Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-36573"
},
{
"type": "WEB",
"url": "https://github.com/llGaetanll/obx/commit/984ad92dc06774da4e6bdae0f5f5e59ae80ece8f"
},
{
"type": "WEB",
"url": "https://gist.github.com/mestrtee/fd8181bbc180d775f8367a2b9e0ffcd1"
},
{
"type": "PACKAGE",
"url": "https://github.com/llGaetanll/obx"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "obx Prototype Pollution"
}
GHSA-JJF5-WX3J-3FV7
Vulnerability from github – Published: 2022-05-14 00:01 – Updated: 2022-05-25 22:54This affects the package convict before 6.2.3. This is a bypass of CVE-2022-22143. The fix introduced, relies on the startsWith method and does not prevent the vulnerability: before splitting the path, it checks if it starts with proto or this.constructor.prototype. To bypass this check it's possible to prepend the dangerous paths with any string value followed by a dot, like for example foo.proto or foo.this.constructor.prototype.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "convict"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.2.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-21190"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2022-05-25T22:54:49Z",
"nvd_published_at": "2022-05-13T20:15:00Z",
"severity": "CRITICAL"
},
"details": "This affects the package convict before 6.2.3. This is a bypass of [CVE-2022-22143](https://security.snyk.io/vuln/SNYK-JS-CONVICT-2340604). The [fix](https://github.com/mozilla/node-convict/commit/3b86be087d8f14681a9c889d45da7fe3ad9cd880) introduced, relies on the startsWith method and does not prevent the vulnerability: before splitting the path, it checks if it starts with __proto__ or this.constructor.prototype. To bypass this check it\u0027s possible to prepend the dangerous paths with any string value followed by a dot, like for example foo.__proto__ or foo.this.constructor.prototype.",
"id": "GHSA-jjf5-wx3j-3fv7",
"modified": "2022-05-25T22:54:49Z",
"published": "2022-05-14T00:01:09Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-21190"
},
{
"type": "WEB",
"url": "https://github.com/mozilla/node-convict/commit/1ea0ab19c5208f66509e1c43b0d0f21c1fd29b75"
},
{
"type": "WEB",
"url": "https://gist.github.com/dellalibera/cebce20e51410acebff1f46afdc89808"
},
{
"type": "PACKAGE",
"url": "https://github.com/mozilla/node-convict"
},
{
"type": "WEB",
"url": "https://github.com/mozilla/node-convict/blob/3b86be087d8f14681a9c889d45da7fe3ad9cd880/packages/convict/src/main.js%23L571"
},
{
"type": "WEB",
"url": "https://github.com/mozilla/node-convict/blob/master/CHANGELOG.md%23623---2022-05-07"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/SNYK-JS-CONVICT-2774757"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Prototype Pollution in convict"
}
GHSA-JJF7-VP9P-J843
Vulnerability from github – Published: 2024-03-15 15:30 – Updated: 2024-03-15 15:30Cryptographic key vulnerability encoded in the FriendlyWrt firmware affecting version 2022-11-16.51b3d35. This vulnerability could allow an attacker to compromise the confidentiality and integrity of encrypted data.
{
"affected": [],
"aliases": [
"CVE-2024-2495"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-03-15T13:15:09Z",
"severity": "MODERATE"
},
"details": "Cryptographic key vulnerability encoded in the FriendlyWrt firmware affecting version 2022-11-16.51b3d35. This vulnerability could allow an attacker to compromise the confidentiality and integrity of encrypted data.",
"id": "GHSA-jjf7-vp9p-j843",
"modified": "2024-03-15T15:30:43Z",
"published": "2024-03-15T15:30:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-2495"
},
{
"type": "WEB",
"url": "https://www.incibe.es/en/incibe-cert/notices/aviso/cryptographic-key-plain-text-vulnerability-friendlyelecs-friendlywrt"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-JJFF-Q3Q4-5HH8
Vulnerability from github – Published: 2024-04-18 15:30 – Updated: 2026-06-11 14:14An issue inandrei-tatar nora-firebase-common between v.1.0.41 and v.1.12.2 allows a remote attacker to execute arbitrary code via a crafted script to the updateState parameter of the updateStateInternal method.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@andrei-tatar/nora-firebase-common"
},
"ranges": [
{
"events": [
{
"introduced": "1.0.41"
},
{
"fixed": "1.12.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-30564"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2024-04-18T16:58:17Z",
"nvd_published_at": "2024-04-18T15:15:30Z",
"severity": "CRITICAL"
},
"details": "An issue inandrei-tatar nora-firebase-common between v.1.0.41 and v.1.12.2 allows a remote attacker to execute arbitrary code via a crafted script to the updateState parameter of the updateStateInternal method.",
"id": "GHSA-jjff-q3q4-5hh8",
"modified": "2026-06-11T14:14:49Z",
"published": "2024-04-18T15:30:49Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-30564"
},
{
"type": "WEB",
"url": "https://github.com/andrei-tatar/nora-firebase-common/issues/9"
},
{
"type": "WEB",
"url": "https://github.com/andrei-tatar/nora-firebase-common/commit/bf30b75d51be04f6c1f884561a223226c890f01b"
},
{
"type": "WEB",
"url": "https://gist.github.com/mestrtee/5dc2c948c2057f98d3de0a9790903c6c"
},
{
"type": "PACKAGE",
"url": "https://github.com/andrei-tatar/nora-firebase-common"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "@andrei-tatar/nora-firebase-common Prototype Pollution vulnerability"
}
GHSA-JP4X-W63M-7WGM
Vulnerability from github – Published: 2018-04-26 15:25 – Updated: 2025-05-29 22:49Versions of hoek prior to 4.2.1 and 5.0.3 are vulnerable to prototype pollution.
The merge function, and the applyToDefaults and applyToDefaultsWithShallow functions which leverage merge behind the scenes, are vulnerable to a prototype pollution attack when provided an unvalidated payload created from a JSON string containing the __proto__ property.
This can be demonstrated like so:
var Hoek = require('hoek');
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';
var a = {};
console.log("Before : " + a.oops);
Hoek.merge({}, JSON.parse(malicious_payload));
console.log("After : " + a.oops);
This type of attack can be used to overwrite existing properties causing a potential denial of service.
Recommendation
Update to version 4.2.1, 5.0.3 or later.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "hoek"
},
"ranges": [
{
"events": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.0.3"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "hoek"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "4.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2018-3728"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2020-06-16T21:43:55Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "Versions of `hoek` prior to 4.2.1 and 5.0.3 are vulnerable to prototype pollution.\n\nThe `merge` function, and the `applyToDefaults` and `applyToDefaultsWithShallow` functions which leverage `merge` behind the scenes, are vulnerable to a prototype pollution attack when provided an _unvalidated_ payload created from a JSON string containing the `__proto__` property.\n\nThis can be demonstrated like so:\n\n```javascript\nvar Hoek = require(\u0027hoek\u0027);\nvar malicious_payload = \u0027{\"__proto__\":{\"oops\":\"It works !\"}}\u0027;\n\nvar a = {};\nconsole.log(\"Before : \" + a.oops);\nHoek.merge({}, JSON.parse(malicious_payload));\nconsole.log(\"After : \" + a.oops);\n```\n\nThis type of attack can be used to overwrite existing properties causing a potential denial of service.\n\n\n## Recommendation\n\nUpdate to version 4.2.1, 5.0.3 or later.",
"id": "GHSA-jp4x-w63m-7wgm",
"modified": "2025-05-29T22:49:49Z",
"published": "2018-04-26T15:25:17Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-3728"
},
{
"type": "WEB",
"url": "https://github.com/hapijs/hoek/commit/32ed5c9413321fbc37da5ca81a7cbab693786dee"
},
{
"type": "WEB",
"url": "https://github.com/hapijs/hoek/commit/5aed1a8c4a3d55722d1c799f2368857bf418d6df"
},
{
"type": "WEB",
"url": "https://hackerone.com/reports/310439"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:1263"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:1264"
},
{
"type": "PACKAGE",
"url": "https://github.com/hapijs/hoek"
},
{
"type": "WEB",
"url": "https://snyk.io/vuln/npm:hoek:20180212"
},
{
"type": "WEB",
"url": "https://web.archive.org/web/20200227131737/https://www.securityfocus.com/bid/103108"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Prototype Pollution in hoek"
}
Mitigation
By freezing the object prototype first (for example, Object.freeze(Object.prototype)), modification of the prototype becomes impossible.
Mitigation
By blocking modifications of attributes that resolve to object prototype, such as proto or prototype, this weakness can be mitigated.
Mitigation
Strategy: Input Validation
When handling untrusted objects, validating using a schema can be used.
Mitigation
By using an object without prototypes (via Object.create(null) ), adding object prototype attributes by accessing the prototype via the special attributes becomes impossible, mitigating this weakness.
Mitigation
Map can be used instead of objects in most cases. If Map methods are used instead of object attributes, it is not possible to access the object prototype or modify it.
CAPEC-1: Accessing Functionality Not Properly Constrained by ACLs
In applications, particularly web applications, access to functionality is mitigated by an authorization framework. This framework maps Access Control Lists (ACLs) to elements of the application's functionality; particularly URL's for web apps. In the case that the administrator failed to specify an ACL for a particular element, an attacker may be able to access it with impunity. An attacker with the ability to access functionality not properly constrained by ACLs can obtain sensitive information and possibly compromise the entire application. Such an attacker can access resources that must be available only to users at a higher privilege level, can access management sections of the application, or can run queries for data that they otherwise not supposed to.
CAPEC-180: Exploiting Incorrectly Configured Access Control Security Levels
An attacker exploits a weakness in the configuration of access controls and is able to bypass the intended protection that these measures guard against and thereby obtain unauthorized access to the system or network. Sensitive functionality should always be protected with access controls. However configuring all but the most trivial access control systems can be very complicated and there are many opportunities for mistakes. If an attacker can learn of incorrectly configured access security settings, they may be able to exploit this in an attack.
CAPEC-77: Manipulating User-Controlled Variables
This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An adversary can override variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the adversary can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.