# CVE-2024-34075: kurwov vulnerable to Denial of Service due to improper data sanitization

> Attackers can cause denial of service in kurwov by injecting specific substrings into datasets, preventing proper generation.

- **Severity:** Medium 6.2 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-hfrv-h3q8-9jpr

## What is CVE-2024-34075?

CVE-2024-34075 is a medium-severity denial of service vulnerability in xiboon kurwov, published on 3 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

kurwov is a fast, dependency-free library for creating Markov Chains. 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. If a string contains a forbidden substring (i.e. `__proto__`) followed by a space character, the code 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). Any dataset can be contaminated with the substring making it unable to properly generate anything in some cases. This issue has been addressed in version 3.2.5 and all users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2024-34075?

2 open source packages ship an affected version, including kurwov.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `kurwov` | npm | From 3.1.0 | 3.2.5 |
| `kurwov` | npm | From 3.1.0 | 3.2.5 |

## How do I fix CVE-2024-34075?

Upgrade kurwov to 3.2.5 or later.

## Is CVE-2024-34075 being exploited?

There is no known exploitation of CVE-2024-34075 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-34075 and fix it if it is affected.

What it is: CVE-2024-34075 is a medium-severity denial of service vulnerability in xiboon kurwov, published on 3 May 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-34075 in the wild and no public exploit code.

Affected packages and fixed versions:
- kurwov (npm): affected from 3.1.0; fixed in 3.2.5
- kurwov (npm): affected from 3.1.0; fixed in 3.2.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-34075/ (Markdown: https://insights.sbomify.com/CVE-2024-34075/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-34075
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-34075
- OSV: https://osv.dev/vulnerability/CVE-2024-34075

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-34075/
Summaries are generated and may contain mistakes; the official description above is the record.
