🇰🇷 한글 설명
thread-amount 0.2.2 미만 버전에서 Windows 및 Apple 플랫폼 사용 시 리소스 누수 취약점이 존재합니다. Windows에서는 핸들(Handle)이 닫히지 않아 핸들 수가 무한히 증가하며, Apple 플랫폼에서는 메모리가 해제되지 않아 메모리 누수가 발생합니다. 이로 인해 시스템 불안정이나 프로세스 강제 종료가 발생할 수 있습니다.
💡 쉬운 설명
프로그램이 현재 실행 중인 작업(스레드)의 개수를 확인할 때, 사용한 자원을 제대로 반납하지 않는 문제입니다. 이 작업이 반복되면 컴퓨터의 메모리나 시스템 자원이 바닥나서 프로그램이 멈추거나 꺼질 수 있습니다.
🇺🇸 원문 (English)
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.
📍 영향받는 시스템
thread-amount version < 0.2.2 (Windows 및 Apple 플랫폼)
⚔️ 공격 벡터
로컬 프로세스 내에서 해당 함수를 반복적으로 호출하여 자원 고갈 유도
🛡️ 대응 방법
thread-amount를 0.2.2 이상의 버전으로 업데이트
🔧 검증 코드
명령어 결과에 0.2.2 미만의 버전이 출력되면 취약한 버전이 설치된 상태입니다.
cargo pkgid thread-amount 2>/dev/null | grep -E 'thread-amount@0\.[0-1]\.[0-9]'