Skip to content

Security: Prototype Pollution via Object.assign in mergeServicesData#830

Open
tomaioo wants to merge 1 commit into
AdguardTeam:mainfrom
tomaioo:fix/security/prototype-pollution-via-object-assign-in
Open

Security: Prototype Pollution via Object.assign in mergeServicesData#830
tomaioo wants to merge 1 commit into
AdguardTeam:mainfrom
tomaioo:fix/security/prototype-pollution-via-object-assign-in

Conversation

@tomaioo

@tomaioo tomaioo commented May 27, 2026

Copy link
Copy Markdown

Summary

Security: Prototype Pollution via Object.assign in mergeServicesData

Problem

Severity: High | File: scripts/services/merge-services-data.js:L17

The mergeServicesData function uses spread and reduce to merge arrays into an object keyed by id. If an attacker can control the id property of a service, they can set it to __proto__, constructor, or prototype, causing prototype pollution when the object is later used. Although Object.values is used, the polluted object can still affect subsequent operations if properties are accessed directly.

Solution

Use Object.create(null) to create a prototype-less object, or validate/sanitize the id field before using it as a key. Alternatively, use a Map instead of a plain object.

Changes

  • scripts/services/merge-services-data.js (modified)

The `mergeServicesData` function uses spread and `reduce` to merge arrays into an object keyed by `id`. If an attacker can control the `id` property of a service, they can set it to `__proto__`, `constructor`, or `prototype`, causing prototype pollution when the object is later used. Although `Object.values` is used, the polluted object can still affect subsequent operations if properties are accessed directly.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant