Email me

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.

Cratethread-amount
TypeVulnerability (denial-of-service)
Affected versionsBefore 0.2.2.
Fixed in0.2.2
SeverityHigh, CVSS 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Published2025-11-22
Last changed2025-11-22
Also known asCVE-2025-65947, GHSA-jf9p-2fv9-2jp2
Affected functionsthread_amount::is_single_threaded, thread_amount::thread_amount

What to do

  1. See which version you have: cargo tree -i thread-amount (it also shows which of your dependencies pulls it in).
  2. 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 example thread-amount = "0.2.2") or update the dependency that pulls it in.
  3. 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

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 →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ