LiteLLM Reveals Portion of API Key via a Logging File
The logging code in LiteLLM only masked the first five characters of an API key, so almost the whole secret was written to log files. Anyone able to read those logs could recover the key and use it to access the upstream model provider.
BerriAI/litellm
Originally disclosed on huntr
In berriai/litellm before version 1.44.12, the litellm/litellm_core_utils/litellm_logging.py file contains a vulnerability where the API key masking code only masks the first 5 characters of the key. This results in the leakage of almost the entire API key in the logs, exposing a significant amount of the secret key. The issue affects version v1.44.9.
From the GitHub Advisory Database (GHSA-g5pg-73fc-hjwq, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The masking routine replaced only the first five characters of the key instead of redacting the whole value.
Impact
The logs could expose almost the entire API key, letting anyone with log access use the key against the upstream provider.
What the attacker needed
Access to LiteLLM log files
The fix
The masking should redact the whole key rather than a fixed prefix; the text says the issue is fixed in version 1.44.12.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
An API key is a long password that lets a program talk to another service. LiteLLM tried to hide the key before writing it to a log file, but it only hid the first few characters, leaving the rest readable. Anyone who could open the log file would see nearly the whole password.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.