CVE-2025-6545: pbkdf2 Predictable Key Generation Critical Vulnerability
N/A
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| pbkdf2 | npm | >= 3.0.10, <= 3.1.2 | 3.1.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability exists in the pbkdf2 package, where the key derivation functions pbkdf2 and pbkdf2Sync can return predictable (zero-filled or uninitialized) buffers instead of cryptographically secure keys. This issue was introduced in commit 9699045c37a07f8319cfb8d44e2ff4252d7a7078.
The root cause is the replacement of the robust create-hmac library with a new, internal HMAC implementation. This new implementation, found in lib/sync.js, uses a hardcoded map of lowercase algorithm names (md5, sha1, sha256, etc.) to determine the hash output size.
When a developer provides an algorithm name that is not in this exact list—either a non-normalized form like 'SHA256' (with uppercase letters) or a different but valid algorithm like 'sha3-512'—the internal logic fails to find the corresponding size. Instead of throwing an error, the code proceeds with incorrect parameters, ultimately leading to the generation of an insecure, predictable output.
This is a critical vulnerability because it can lead to systems generating and using weak or empty keys for sensitive operations, completely undermining the security of the key derivation process. The issue is particularly insidious because it fails silently, giving no indication that the generated key is insecure.