Skip to content
Nconf Issues 445

Nconf Issues 445

github.com • November 26, 2026

I was looking at how nconf handles __proto__ after the CVE-2022-21803 fix and noticed the patch only landed on Memory#set . Memory#merge keeps its own object-walk, and that walk never got the hasOwnProperty guard, so a key with a __proto__ segment and an object value writes straight onto Object.prototype for the whole process.

The merge walk descends into each path segment without rejecting __proto__ or checking own-property:

lib/nconf/stores/memory.js:182

When the key is __proto__ , target['__proto__'] is the live Object.prototype and is truthy, so the guard at :184 never fires and :200 assigns the attacker's value onto the prototype. The sibling set() at memory.js:95 already carries || !Object.hasOwnProperty.call(target, key) ; merge has no equivalent. Because merge redirects a non-object leaf back to the guarded set() (memory.js:165), the payload uses an object value to stay inside the walk.

Environment: Node.js v26.5.0, nconf 1.0.0-beta.2, installed with a one-dependency package.json .

Then one script runs the guarded set() as a control against the unguarded merge() , and checks a security-relevant default on a fresh object:

The control line is the proof: on the same build set() stays clean because its hasOwnProperty guard fires, and only the unguarded merge() reaches Object.prototype . The impact line shows a fresh {} with no own isAdmin reading as true afterward. The same result reproduces on the latest stable 0.13.0.

An actor who controls a key passed to nconf.merge() sets a property on Object.prototype that every plain object in the process then inherits, which flips a security-relevant default — an options object with no own isAdmin reads as admin after the attack. This is an Integrity effect only: it is not RCE and not data theft, and the PoC demonstrates nothing beyond the inherited-property write (hence C:N / A:N ). It is distinct from CVE-2022-21803 , which patched only Memory#set .

Give the merge walk the same own-property / __proto__ rejection set() already has:

As a workaround, don't pass externally-influenced key strings or object graphs to nconf.merge() , and consider Object.freeze(Object.prototype) at startup where compatible.

Extracted Entities

Platforms (1)

Vulnerabilities (1)