GHSA-HFRV-H3Q8-9JPR
Vulnerability from github – Published: 2024-05-03 20:30 – Updated: 2024-05-03 20:30Summary
An unsafe sanitization of dataset contents on the MarkovData#getNext method used in Markov#generate and Markov#choose allows a maliciously crafted string on the dataset to throw and stop the function from running properly.
Details
https://github.com/xiboon/kurwov/blob/0d58dfa42135ab40e830e92622857282f980ca89/src/MarkovData.ts#L38-L44
If a string contains a forbidden substring (i.e. __proto__) followed by a space character, the second line will access a special property in MarkovData#finalData by removing the last character of the string, bypassing the dataset sanitization (as it is supposed to be already sanitized before this function is called).
data is then defined as the special function found in its prototype instead of an array.
On the last line, data is then indexed by a random number, which is supposed to return a string but returns undefined as it's a function. Calling endsWith then throws.
PoC
https://runkit.com/embed/m6uu40r5ja9b
Impact
Any dataset can be contaminated with the substring making it unable to properly generate anything in some cases.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "kurwov"
},
"ranges": [
{
"events": [
{
"introduced": "3.1.0"
},
{
"fixed": "3.2.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-34075"
],
"database_specific": {
"cwe_ids": [
"CWE-502"
],
"github_reviewed": true,
"github_reviewed_at": "2024-05-03T20:30:38Z",
"nvd_published_at": "2024-05-03T18:15:09Z",
"severity": "MODERATE"
},
"details": "### Summary\nAn unsafe sanitization of dataset contents on the `MarkovData#getNext` method used in `Markov#generate` and `Markov#choose` allows a maliciously crafted string on the dataset to throw and stop the function from running properly.\n\n### Details\nhttps://github.com/xiboon/kurwov/blob/0d58dfa42135ab40e830e92622857282f980ca89/src/MarkovData.ts#L38-L44\n\nIf a string contains a forbidden substring (i.e. `__proto__`) followed by a space character, the second line will access a special property in `MarkovData#finalData` by removing the last character of the string, bypassing the dataset sanitization (as it is supposed to be already sanitized before this function is called).\n\n`data` is then defined as the special function found in its prototype instead of an array.\n\nOn the last line, `data` is then indexed by a random number, which is supposed to return a string but returns undefined as it\u0027s a function. Calling `endsWith` then throws.\n\n### PoC\nhttps://runkit.com/embed/m6uu40r5ja9b\n\n### Impact\nAny dataset can be contaminated with the substring making it unable to properly generate anything in some cases.",
"id": "GHSA-hfrv-h3q8-9jpr",
"modified": "2024-05-03T20:30:38Z",
"published": "2024-05-03T20:30:38Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/xiboon/kurwov/security/advisories/GHSA-hfrv-h3q8-9jpr"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-34075"
},
{
"type": "WEB",
"url": "https://github.com/xiboon/kurwov/commit/85d63e652594f121d6656177d7a3c0d823c976c9"
},
{
"type": "PACKAGE",
"url": "https://github.com/xiboon/kurwov"
},
{
"type": "WEB",
"url": "https://github.com/xiboon/kurwov/blob/0d58dfa42135ab40e830e92622857282f980ca89/src/MarkovData.ts#L38-L44"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "kurwov vulnerable to Denial of Service due to improper data sanitization"
}
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.