jaredhanson / jaredhanson/utils-merge

Prototype pollution vulnerability in utils-merge

Open Beginner friendly
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
69
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Hi, we are a security team. We found a prototype pollution vulnerability in your project.

The issue affects utils-merge.

The vulnerable behavior happens when properties from a user-controlled source object are copied into a target object through dynamic property assignment. If a special key such as __proto__ is present, prototype pollution may occur.

Impact

An attacker may be able to change the prototype of the target object in the affected runtime.

Proof of concept

const merge = require('utils-merge');

const target = {};
merge(target, { ['__proto__']: { polluted: true } });

console.log(target.polluted); // true

Details

We confirmed the following case:

  • sink: ./index.js:19

The root cause is that untrusted keys are copied through dynamic property writes without blocking special prototype-related keys.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ./index.js:19, where properties from the source object are copied through dynamic assignment. Reproduce the provided proto example and inspect the existing tests, then add coverage showing that special prototype-related keys cannot pollute the target. Run the project test suite and confirm the proof of concept no longer changes the target prototype.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.