{"id":"CVE-2025-65947","aliases":["CVE-2025-65947","GHSA-jf9p-2fv9-2jp2","RUSTSEC-2025-0125"],"related":[],"kind":"vulnerability","state":"published","title":"thread-amount is Vulnerable to Resource Exhaustion (Memory and Handle Leaks) on Windows and macOS","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"Affected versions of this crate contain resource leaks when querying thread counts on Windows and Apple platforms.\n\n### Windows\nThe `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.\n\n### macOS / iOS\nThe `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.\n\n### Impact\nLong-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.\n\n### Resources\n\n- https://github.com/jzeuzs/thread-amount/pull/29","format":"markdown","source":"ghsa"},{"lang":"en","text":"Affected versions of this crate contain resource leaks when querying thread counts on Windows and Apple platforms.\n\n### Windows\nThe `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.\n\n### macOS / iOS\nThe `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.\n\n### Impact\nLong-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.\n\n### Mitigation\nUpgrade to version `0.2.2` or later, which properly releases OS resources.","format":"markdown","source":"rustsec"},{"lang":"es","text":"thread-amount es una herramienta que obtiene la cantidad de hilos en el proceso actual. Versiones anteriores a la 0.2.2, existen fugas de recursos al consultar el recuento de hilos en plataformas Windows y Apple. En plataformas Windows, la función thread_amount llama a CreateToolhelp32Snapshot pero no cierra el HANDLE devuelto usando CloseHandle. Llamadas repetidas a esta función harán que el recuento de handles del proceso crezca indefinidamente, lo que eventualmente conducirá a inestabilidad del sistema o terminación del proceso cuando se alcance el límite de handles. En plataformas Apple, la función thread_amount llama a task_threads (a través de las API del kernel Mach) que asigna memoria para la lista de hilos. La función no desasigna esta memoria usando vm_deallocate. Llamadas repetidas resultarán en una fuga de memoria constante, lo que eventualmente hará que el proceso sea terminado por el eliminador OOM (Out of Memory). Este problema ha sido parcheado en la versión 0.2.2.","source":"nvd"}],"published":"2025-11-21T18:19:40.000Z","modified":"2026-10-18T20:10:00.110Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"HIGH"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-400","CWE-772"],"affected":[{"ranges":[{"version":"< 0.2.2","status":"affected"}],"vendor":"jzeuzs","product":"thread-amount","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.2"}],"ecosystem":"crates.io","package":"thread-amount","purl":"pkg:cargo/thread-amount","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.2.2"}],"ecosystem":"crates.io","package":"thread-amount","purl":"pkg:cargo/thread-amount","source":"rustsec"}],"references":[{"url":"https://github.com/jzeuzs/thread-amount/security/advisories/GHSA-jf9p-2fv9-2jp2","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jzeuzs/thread-amount/pull/29","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://github.com/jzeuzs/thread-amount/commit/28860d4a38286609cb884c13b5b7941edc2390e5","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-65947","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/jzeuzs/thread-amount","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2025-0125.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/thread-amount","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-11-24T14:56:11.090Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-65947","url":"https://www.cve.org/CVERecord?id=CVE-2025-65947","licence":"CVE Terms of Use","modified":"2025-11-24T14:56:27.822Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jf9p-2fv9-2jp2","url":"https://github.com/advisories/GHSA-jf9p-2fv9-2jp2","licence":"CC-BY-4.0","modified":"2025-11-27T08:16:21.759Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2025-0125","url":"https://rustsec.org/advisories/RUSTSEC-2025-0125.html","licence":"CC0-1.0","modified":"2025-11-22T12:29:36.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-65947","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-65947","licence":"Public domain","modified":"2026-10-18T20:10:00.110Z"}],"updatedAt":"2026-11-25T22:59:07.934Z","epss":{"score":0.00371,"percentile":0.33077,"date":"2026-12-01T12:00:22.000Z"}}