LiteLLM Authentication Bypass via Password Hash Exposure and Pass-the-Hash
LiteLLM versions before 1.83.0 stored user passwords as unsalted SHA-256 hashes and exposed these hashes through multiple API endpoints, enabling an authenticated user to retrieve another user's password hash and use it to log in as that user due to the /v2/login endpoint accepting the raw SHA-256 hash without re-hashing, leading to potential privilege escalation.
LiteLLM versions prior to 1.83.0 are vulnerable to an authentication bypass vulnerability. User passwords are stored as unsalted SHA-256 hashes, a weak cryptographic practice that makes them susceptible to rainbow table attacks. Furthermore, these password hashes are exposed through several API endpoints, including /user/info, /user/update, and /spend/users, allowing any authenticated user to retrieve them. The /v2/login endpoint also accepts the raw SHA-256 hash as a valid password without proper re-hashing. This combination of vulnerabilities allows an attacker with low-level access to escalate privileges by obtaining another user’s password hash and using it to directly log in as that user. Defenders should upgrade to version 1.83.0 or later to mitigate this vulnerability.
Attack Chain
- Attacker gains initial access to LiteLLM and authenticates as a low-privilege user.
- Attacker sends a request to
/user/infoto retrieve the password hash of another user. - The API responds with the target user’s SHA-256 password hash.
- Attacker sends a POST request to the
/v2/loginendpoint using the stolen SHA-256 hash as the password. - The
/v2/loginendpoint accepts the raw SHA-256 hash without re-hashing. - The server authenticates the attacker as the target user.
- Attacker now has the privileges of the target user, potentially gaining access to sensitive data or administrative functions.
Impact
Successful exploitation of this vulnerability leads to unauthorized access and privilege escalation within the LiteLLM application. An attacker can impersonate other users, including administrators, potentially leading to data breaches, system compromise, and unauthorized modifications. The number of victims depends on the deployment size, but any LiteLLM instance running a version prior to 1.83.0 is vulnerable. Sectors utilizing LiteLLM are at risk.
Recommendation
- Upgrade LiteLLM to version 1.83.0 or later to patch the vulnerability (reference: Patches section).
- Deploy the Sigma rule “Detect LiteLLM User Info Hash Access” to monitor for unauthorized access to user password hashes via the
/user/infoendpoint (reference: rule: “Detect LiteLLM User Info Hash Access”). - Deploy the Sigma rule “Detect LiteLLM Login with SHA256 Hash” to detect login attempts using SHA256 hashes (reference: rule: “Detect LiteLLM Login with SHA256 Hash”).
Detection coverage 2
Detect LiteLLM User Info Hash Access
mediumDetects access to the /user/info endpoint, which exposes user password hashes in LiteLLM versions prior to 1.83.0.
Detect LiteLLM Login with SHA256 Hash
highDetects login attempts to the /v2/login endpoint using a 64-character hexadecimal string as the password, indicating a potential pass-the-hash attack in LiteLLM.
Detection queries are kept inside the platform. Get full rules →