CVE-2018-3728: Hoek Prototype Pollution Vulnerability

HIGH
Advisory Identifier: GHSA-jp4x-w63m-7wgm
CVSS 8.8
CWE-1321
Published
Advisory Summary

CVE-2018-3728 is a HIGH (CVSS 8.8) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Hoek libraries in the npm ecosystem. The issue involves prototype pollution in hoek. Remediation is available by upgrading affected packages to version 5.0.3, 4.2.1.

CVE-2018-3728 at a Glance

CVE Identifier CVE-2018-3728
GHSA Identifier GHSA-jp4x-w63m-7wgm
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Hoek
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2018-3728

To remediate this vulnerability, upgrade all affected Hoek dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

hoek fixed: 5.0.3
npm install hoek@5.0.3
hoek fixed: 4.2.1
npm install hoek@4.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls hoek

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2018-3728, inspect your project dependencies using npm:

npm ls hoek

Analyze the terminal output to locate any version of Hoek in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.3), your application is affected.

Note: The npm ls hoek command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where 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. In Hoek, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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: ```javascript 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.

CVE-2018-3728 Affected Hoek Versions

2 component(s)
Fixed Versions:
5.0.34.2.1
Product / Package Ecosystem Affected Versions Fixed Version
hoek
npm
≥ 5.0.0
< 5.0.3
5.0.3
hoek
npm
< 4.2.1
4.2.1

References

Frequently Asked Questions

What is CVE-2018-3728?
CVE-2018-3728 is a security vulnerability in Hoek involving Prototype Pollution in hoek under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Hoek versions are affected?
Affected versions include releases prior to 5.0.3, 4.2.1 across affected packages: hoek.
What version fixes CVE-2018-3728?
Upgrading to 5.0.3, 4.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hoek affected?
Yes, hoek is affected in releases prior to 5.0.3, 4.2.1. Upgrade your dependency to 5.0.3, 4.2.1 or later.
What is the CVSS score of CVE-2018-3728?
CVE-2018-3728 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2018-3728?
CVE-2018-3728 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (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.).
How can I check npm dependencies for CVE-2018-3728?
Run the dependency tree command: 'npm ls hoek'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jp4x-w63m-7wgm",
  "modified" : "2025-05-29T22:49:49Z",
  "published" : "2018-04-26T15:25:17Z",
  "aliases" : [ "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.\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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "hoek"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "hoek"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.2.1"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:43:55Z",
    "nvd_published_at" : null
  }
}