Advisory

GHSA-jp4x-w63m-7wgm

Also known as: CVE-2018-3728

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.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2018-04-26 15:25 UTC
Modified
2025-05-29 22:49 UTC

Affected packages and fixes

hoek

npm · All systems

Affected

  • introduced 5.0.0, fixed 5.0.3 (semver)

Fixed versions

5.0.3

Fix

hoek

npm · All systems

Affected

  • introduced 0, fixed 4.2.1 (semver)

Fixed versions

4.2.1

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences