🇰🇷 한글 설명
pbkdf2 3.1.6 버전 이하의 JavaScript 폴백 구현에서 블록 크기보다 긴 비밀번호를 처리할 때 매 반복마다 전체를 다시 해싱하여 성능 저하를 유발합니다. 이로 인해 비밀번호 길이가 길 경우 연산 비용이 기하급수적으로 증가하여 이벤트 루프를 차단할 수 있습니다.
💡 쉬운 설명
비밀번호가 너무 길면 컴퓨터가 이를 처리하는 데 너무 많은 시간을 써서 프로그램이 멈출 수 있는 문제입니다. 아주 긴 비밀번호를 입력하면 시스템이 과부하에 걸려 응답하지 않게 됩니다.
🇺🇸 원문 (English)
pbkdf2 through 3.1.6 re-hashes passwords longer than the digest's block size on every iteration in its JavaScript fallback (lib/sync.js). A password longer than the block size (64 bytes, or 128 bytes for sha384 and sha512) is passed to HMAC as the key on every iteration, and HMAC hashes such keys in full each time. Cost is therefore O(iterations × password length), and a long password can block the event loop. The fallback is used by pbkdf2Sync and pbkdf2 on Node.js before 0.12, on Bun (1.0.0 through 1.1.34, and 1.2.6 and later), and on Deno 2.9.0 and later, because their native pbkdf2Sync fails the library's feature check. It is also used when lib/sync.js is imported directly. Node.js 0.12 and later, and browser builds (which use lib/sync-browser.js), are not affected. Applications that enforce a reasonable maximum password length are not meaningfully affected.
📍 영향받는 시스템
pbkdf2 3.1.6 이하, Bun (1.0.0-1.1.34, 1.2.6 이상), Deno 2.9.0 이상
⚔️ 공격 벡터
매우 긴 비밀번호를 입력하여 시스템의 CPU 자원을 고갈시키고 이벤트 루프를 차단하는 서비스 거부(DoS) 공격
🛡️ 대응 방법
pbkdf2 라이브러리를 최신 버전으로 업데이트하거나, 입력되는 비밀번호의 최대 길이를 제한하도록 애플리케이션 로직을 수정합니다.
🔧 검증 코드
출력된 pbkdf2의 버전이 3.1.6 이하인지 확인합니다.