NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LobeChat

CVE-2024-37895: Lobe Chat API Key Leak

mediumCVSS 3.1 5.7GHSA-p36r-qxgx-jq2v

Lobe Chat (`@lobehub/chat`) before 0.162.25 lets a user who has logged in with SSO or an Access Code steal the server's real model-provider API key. They point the Base URL at their own server and send the request server-side, so the key arrives in the request headers. Upgrade to 0.162.25.

Published Jun 17, 2024 · Analysis Nov 1, 2026

What an attacker can do

Community-edition Lobe Chat deployments often hold one provider API key on the server and protect the app with an Access Code or SSO. The frontend lets a user set the provider Base URL, and the user can choose to have the request sent from the server rather than the browser. The server then attaches its own API key and calls whatever address the user supplied.

The attacker needs only a valid login or the shared Access Code. They set the Base URL to a server they run, trigger a chat request, and read the key from the Authorization header of the incoming call. The advisory names two enabling conditions: the version allows setting a Base URL, and the backend has no outbound traffic allowlist. The result is theft of the backend key, which can then be used outside the app against your quota and billing. The vector rates confidentiality high and nothing else; the app itself is not taken over.

Who is affected

Affected: @lobehub/chat < 0.162.25 (0.162.24 and earlier), community deployments that use SSO or an Access Code and hold a server-side API key. The reporter tested 0.162.13. Check what you run:

npm ls @lobehub/chat

For Docker, read the image tag instead. If you share the Access Code with many people, all of them can use this.

@lobehub/chat

Ecosystem
npm
Affected
< 0.162.25
Fixed in
0.162.25
Check
npm ls @lobehub/chat

How to fix it

Upgrade to @lobehub/chat 0.162.25.

npm install @lobehub/[email protected]

The advisory gives no workaround and no description of the code change. Because the leaked key is a real secret, rotate the provider key after upgrading if you had an Access Code shared among users you do not fully trust. Egress filtering on the server, so it can reach only known provider hosts, addresses the missing allowlist.

How to tell if you were hit

Check provider-side usage logs for calls to your API key from unfamiliar addresses or at unusual volume. In server logs, look for chat requests whose configured Base URL is not a known provider endpoint. On the network side, look for outbound connections from the Lobe Chat server to hosts that are not your provider or other known services. Rotate the key if you find any of these.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

If an attacker can successfully authenticate through SSO/Access Code, they can obtain the real backend API Key by modifying the base URL to their own attack URL on the frontend and setting up a server-side request.

Details

The attack process is described above.

image

PoC

Frontend:

  1. Pass basic authentication (SSO/Access Code).
  2. Set the Base URL to a private attack address.
  3. Configure the request method to be a server-side request.
  4. At the self-set attack address, retrieve the API Key information from the request headers.

Backend:

  1. The LobeChat version allows setting the Base URL.
  2. There is no outbound traffic whitelist.

Impact

All community version LobeChat users using SSO/Access Code authentication, tested on version 0.162.13.

Credited to zhuozhiyongde.

Questions

Does CVE-2024-37895 work without a login?

No. The attacker has to pass SSO or the Access Code first. Anyone who has the shared Access Code counts as a possible attacker.

What does the attacker actually get?

The real backend API key, read from the headers of the request that the server sends to the attacker's Base URL. The advisory describes no further access to the app.

Is the fix to rotate the key?

Rotating is a precaution after the leak. The fixed release is 0.162.25.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LobeChat vulnerabilities

All LobeChat entries