A timing side-channel vulnerability in Hashicorp Vault's userpass authentication method allows attackers to enumerate valid usernames. This vulnerability, CVE-2025-6011, exists because of a flaw in how Vault handles login attempts for non-existent users.
When a login attempt is made for a username that does not exist, Vault uses a placeholder password to perform a bcrypt comparison. In vulnerable versions, this placeholder was a simple string, which is not a valid bcrypt hash. The bcrypt.CompareHashAndPassword function fails very quickly when given an invalid hash, resulting in a noticeable time difference compared to a login attempt for an existing user with a valid hash. An attacker can exploit this timing difference to determine whether a username exists or not.
The vulnerability was addressed by replacing the placeholder string with a valid, hardcoded bcrypt hash. This ensures that the comparison operation takes a similar amount of time for both existing and non-existing users, thus mitigating the timing side-channel.
The vulnerable function is backend.pathLogin, located in the builtin/credential/userpass/path_login.go file. This function is responsible for handling the userpass login process, including the flawed password comparison for non-existent users.