LiteLLM Server-Side Request Forgery (SSRF) vulnerability
The LiteLLM server accepted a user-supplied api_base parameter on chat completion requests and forwarded the request, including the OpenAI API key, to that domain. A malicious user could point api_base at their own server and capture the API key.
BerriAI/litellm
Originally disclosed on huntr
A Server-Side Request Forgery (SSRF) vulnerability exists in berriai/litellm version 1.38.10. This vulnerability allows users to specify the api_base parameter when making requests to POST /chat/completions, causing the application to send the request to the domain specified by api_base. This request includes the OpenAI API key. A malicious user can set the api_base to their own domain and intercept the OpenAI API key, leading to unauthorized access and potential misuse of the API key.
From the GitHub Advisory Database (GHSA-g26j-5385-hhw3, 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
Likely the server trusted the user-controlled api_base value and forwarded the request with the OpenAI API key attached, without restricting the destination.
Impact
A malicious user could intercept the OpenAI API key, leading to unauthorised access and potential misuse of the API key.
What the attacker needed
Ability to send requests to POST /chat/completions; attacker-controlled domain
How it was found
- Send a request to POST /chat/completions with the api_base parameter set to an attacker-controlled domain.
- The application sends the request, including the OpenAI API key, to that domain.
- The attacker receives and intercepts the OpenAI API key.
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.
Server-Side Request Forgery (SSRF) is when an application makes a network request to an address chosen by the user. Here the server sent a request to whatever domain the user put in api_base, and it attached a secret API key to that request. The attacker just had to supply their own domain to receive the key.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.