================================================================================ legitbiz[research] // advisory ================================================================================ id: LB-2026-004 // n-deep-merge target: n-deep-merge <= 0.0.2 (npm) type: Prototype Pollution (CWE-1321) severity: High (CVSS:3.1 7.3 - AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H) channel: GitHub Issues / Coordinated Disclosure date: 2026-11-27 status: submitted / vendor notified researcher: legitbiz[research] -------------------------------------------------------------------------------- [01] // summary -------------------------------------------------------------------------------- A prototype-pollution vulnerability in n-deep-merge version <= 0.0.2 allows an attacker who can influence an object passed to deepmerge() to write arbitrary properties onto the global Object.prototype, affecting every object in the application. -------------------------------------------------------------------------------- [02] // root cause analysis (merge.js) -------------------------------------------------------------------------------- In merge.js, deepmerge(dest, ...sources) walks sources using:  for (var key in source) dest[key] = deepmerge(dest[key], source[key]) with no guard, mutating `dest` in place. With `key === '__proto__'`, `dest['__proto__']` resolves to Object.prototype, allowing attacker keys to be written directly onto it. -------------------------------------------------------------------------------- [03] // proof of concept -------------------------------------------------------------------------------- const deepmerge = require('n-deep-merge'); deepmerge({}, JSON.parse('{"__proto__":{"ndm_pwned":"YES"}}')); console.log(({}).ndm_pwned); // "YES" -- Object.prototype is polluted -------------------------------------------------------------------------------- [04] // impact assessment -------------------------------------------------------------------------------- * CVSS v3.1 Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H (Score: 7.3 High) * Arbitrary property injection into global object prototypes, altering  application state and enabling denial of service or code execution gadget chains. -------------------------------------------------------------------------------- [05] // remediation -------------------------------------------------------------------------------- Denylist prototype keys before recursion:  const UNSAFE = new Set(['__proto__', 'constructor', 'prototype']);  for (var key in source) {  if (UNSAFE.has(key)) continue;  dest[key] = deepmerge(dest[key], source[key]);  } ================================================================================