Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0yZ3F3LXE5cjktN2Y3Oc4AAnwz

Changeset vulnerable to prototype pollution

Overview

Prototype pollution vulnerability in 'changeset' versions 0.0.1 through 0.2.5 allows attackers to cause a denial of service and may lead to remote code execution.

Details

The npm module 'changeset' can be abused by Prototype Pollution vulnerability since the function 'apply()' does not check for the type of object before assigning value to the property. Due to this flaw an attacker could create a non-existent property or able to manipulate the property which leads to Denial of Service or potentially Remote code execution.

PoC Details

The 'apply()' function accepts 'changes, target, modify' as argument. Due to the absence of validation on the values passed into the 'changes' argument, an attacker can supply a malicious value by adjusting the value to include the 'proto' property. Since there is no validation before assigning the property to check whether the assigned argument is the Object's own property or not, the property 'polluted' will be directly be assigned to the new object thereby polluting the Object prototype. Using the example below, if there is a check to validate 'polluted' the valued later in the code, it would be substituted as "Yes! Its Polluted" as it had been polluted.

PoC Code

var changeset = require("changeset") const patch = [{
    type: 'put',
    key: ["__proto__", "polluted"],
    value: "Yes! Its Polluted"
}];
console.log("Before : " + {}.polluted);
changeset.apply(patch, {}, true);
console.log("After : " + {}.polluted);
Permalink: https://github.com/advisories/GHSA-2gqw-q9r9-7f79
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yZ3F3LXE5cjktN2Y3Oc4AAnwz
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: almost 2 years ago
Updated: 7 months ago


CVSS Score: 9.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-2gqw-q9r9-7f79, CVE-2021-25915
References: Repository: https://github.com/eugeneware/changeset
Blast Radius: 16.1

Affected Packages

npm:changeset
Dependent packages: 100
Dependent repositories: 44
Downloads: 17,994 last month
Affected Version Ranges: >= 0.0.1, < 0.2.5
Fixed in: 0.2.5
All affected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.1.0, 0.2.0, 0.2.1, 0.2.3, 0.2.4
All unaffected versions: 0.2.5, 0.2.6