================================================================================ legitbiz[research] // advisory ================================================================================ id: LB-2026-006 // custom-merge target: custom-merge <= 1.0.0 (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 custom-merge version <= 1.0.0 allows an attacker who can influence an object passed to the recursive merge sink to write arbitrary properties onto the global Object.prototype, affecting every object across the runtime. -------------------------------------------------------------------------------- [02] // root cause analysis (index.js) -------------------------------------------------------------------------------- In index.js, the recursive merge(a, b, level) function iterates Object.keys(b) and assigns a[key] = merge(a[key], b[key], ++level) with no guard for sensitive keys. When key === "__proto__", a["__proto__"] resolves to Object.prototype, so the recursion writes attacker-controlled keys directly onto the global prototype. A JSON-parsed payload carries __proto__ as an own enumerable property, allowing it to pass the Object.keys(b) check and reach the sink unsanitized. -------------------------------------------------------------------------------- [03] // proof of concept -------------------------------------------------------------------------------- const createMerger = require('custom-merge'); const merge = createMerger(); // defaults: deep=true, inPlace=true merge({}, JSON.parse('{"__proto__":{"pwned":"YES"}}')); console.log(({}).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) * Global prototype pollution causes denial of service, property-based auth  bypasses, and remote code execution via prototype gadget chains. The  corruption persists for the full lifecycle of the Node.js process. -------------------------------------------------------------------------------- [05] // remediation -------------------------------------------------------------------------------- Denylist prototype keys before recursing:  Object.keys(b).forEach(function(key) {  if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;  a[key] = merge(a[key], b[key], ++level);  }); Alternatively, merge into Object.create(null) target dictionaries. ================================================================================