GHSA-2GQW-Q9R9-7F79
Vulnerability from github – Published: 2022-05-24 17:44 – Updated: 2023-10-19 18:27Overview
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);
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "changeset"
},
"ranges": [
{
"events": [
{
"introduced": "0.0.1"
},
{
"fixed": "0.2.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2021-25915"
],
"database_specific": {
"cwe_ids": [
"CWE-1321"
],
"github_reviewed": true,
"github_reviewed_at": "2023-10-19T18:27:41Z",
"nvd_published_at": "2021-03-09T15:15:00Z",
"severity": "CRITICAL"
},
"details": "### Overview\nPrototype pollution vulnerability in \u0027changeset\u0027 versions 0.0.1 through 0.2.5 allows attackers to cause a denial of service and may lead to remote code execution.\n\n### Details\nThe npm module \u0027changeset\u0027 can be abused by Prototype Pollution vulnerability since the function \u0027apply()\u0027 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.\n\n### PoC Details\nThe \u0027apply()\u0027 function accepts \u0027changes, target, modify\u0027 as argument. Due to the absence of validation on the values passed into the \u0027changes\u0027 argument, an attacker can supply a malicious value by adjusting the value to include the \u0027__proto__\u0027 property. Since there is no validation before assigning the property to check whether the assigned argument is the Object\u0027s own property or not, the property \u0027polluted\u0027 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 \u0027polluted\u0027 the valued later in the code, it would be substituted as \"Yes! Its Polluted\" as it had been polluted.\n\n### PoC Code\n\n```js\nvar changeset = require(\"changeset\") const patch = [{\n type: \u0027put\u0027,\n key: [\"__proto__\", \"polluted\"],\n value: \"Yes! Its Polluted\"\n}];\nconsole.log(\"Before : \" + {}.polluted);\nchangeset.apply(patch, {}, true);\nconsole.log(\"After : \" + {}.polluted);\n```",
"id": "GHSA-2gqw-q9r9-7f79",
"modified": "2023-10-19T18:27:41Z",
"published": "2022-05-24T17:44:00Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-25915"
},
{
"type": "WEB",
"url": "https://github.com/eugeneware/changeset/commit/9e588844edbb9993b32e7366cc799262b4447f99"
},
{
"type": "PACKAGE",
"url": "https://github.com/eugeneware/changeset"
},
{
"type": "WEB",
"url": "https://web.archive.org/web/20210323102946/https://www.whitesourcesoftware.com/vulnerability-database/CVE-2021-25915"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Changeset vulnerable to prototype pollution"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.