GHSA-jp4x-w63m-7wgm

Suggest an improvement
Source
https://github.com/advisories/GHSA-jp4x-w63m-7wgm
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/04/GHSA-jp4x-w63m-7wgm/GHSA-jp4x-w63m-7wgm.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-jp4x-w63m-7wgm
Aliases
Published
2018-04-26T15:25:17Z
Modified
2023-11-08T04:00:17.609911Z
Severity
  • 8.8 (High) CVSS_V3 - CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Prototype Pollution in hoek
Details

Versions 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.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-1321"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2020-06-16T21:43:55Z"
}
References

Affected packages

npm / hoek

Package

Affected ranges

Type
SEMVER
Events
Introduced
5.0.0
Fixed
5.0.3

npm / hoek

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.2.1