Rust advisories / thread-amount
Vulnerability HighRUSTSEC-2025-0125 · thread-amount
RUSTSEC-2025-0125: Resource Exhaustion (Memory and Handle Leaks) on Windows and macOS
Short answerA security vulnerability in the thread-amount crate: Resource Exhaustion (Memory and Handle Leaks) on Windows and macOS. High severity (CVSS 7.5). Fixed in 0.2.2: update to a fixed version.
| Crate | thread-amount |
|---|---|
| Type | Vulnerability (denial-of-service) |
| Affected versions | Before 0.2.2. |
| Fixed in | 0.2.2 |
| Severity | High, CVSS 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Published | 2025-11-22 |
| Last changed | 2025-11-22 |
| Also known as | CVE-2025-65947, GHSA-jf9p-2fv9-2jp2 |
| Affected functions | thread_amount::is_single_threaded, thread_amount::thread_amount |
What to do
- See which version you have:
cargo tree -i thread-amount(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p thread-amount. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplethread-amount = "0.2.2") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Affected versions of this crate contain resource leaks when querying thread counts on Windows and Apple platforms.
Windows
The thread_amount function calls CreateToolhelp32Snapshot but fails to close the returned HANDLE using CloseHandle. Repeated calls to this function will cause the handle count of the process to grow indefinitely, eventually leading to system instability or process termination when the handle limit is reached.
macOS / iOS
The thread_amount function calls task_threads (via Mach kernel APIs) which allocates memory for the thread list. The function fails to deallocate this memory using vm_deallocate. Repeated calls will result in a steady memory leak, eventually causing the process to be killed by the OOM (Out of Memory) killer.
Impact
Long-running applications (such as servers, daemons, or monitoring tools) that use this crate to periodically check thread counts will eventually crash due to resource exhaustion.
Mitigation
Upgrade to version 0.2.2 or later, which properly releases OS resources.
References
- Package: crates.io/crates/thread-amount
- Advisory: rustsec.org/advisories/RUSTSEC-2025-0125.html
- Web: github.com/jzeuzs/thread-amount/pull/29
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?