{"id":"GHSA-jp4x-w63m-7wgm","summary":"Prototype Pollution in hoek","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('hoek');\nvar malicious_payload = '{\"__proto__\":{\"oops\":\"It works !\"}}';\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.","aliases":["CVE-2018-3728"],"modified":"2025-05-29T22:49:49Z","published":"2018-04-26T15:25:17Z","database_specific":{"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2020-06-16T21:43:55Z","nvd_published_at":null,"cwe_ids":["CWE-1321"]},"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"}],"affected":[{"package":{"name":"hoek","ecosystem":"npm","purl":"pkg:npm/hoek"},"ranges":[{"type":"SEMVER","events":[{"introduced":"5.0.0"},{"fixed":"5.0.3"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/04/GHSA-jp4x-w63m-7wgm/GHSA-jp4x-w63m-7wgm.json"}},{"package":{"name":"hoek","ecosystem":"npm","purl":"pkg:npm/hoek"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"4.2.1"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/04/GHSA-jp4x-w63m-7wgm/GHSA-jp4x-w63m-7wgm.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}