[KongchangAI]
· 2 min read· 1,213 words

LLM 0.37.2 Fixes API Key Leak Vulnerability: Two Paths Could Send Keys to Third Parties

LLM 0.37.2 Fixes API Key Leak Vulnerability: Two Paths Could Send Keys to Third Parties

LLM 0.37.2 fixes a security issue where OpenAI keys could be silently sent to third-party compatible endpoints under two configuration paths.

Simon Willison's LLM command-line tool released 0.37.2, fixing two security advisories reported by Daniel de Araujo (BluePlexus). When connecting to third-party OpenAI-compatible endpoints via extra-openai-models.yaml or llm openai endpoint add, an unstored api_key_name may fall back to the real OpenAI API Key, and a model marked responses: true run with -o chat_completions 1 may also send the OpenAI key outward. The fix makes key fallback fail explicitly rather than silently using the default key.

Simon Willison's LLM command-line tool has released version 0.37.2, fixing a security issue reported by security researcher Daniel de Araujo (GitHub username BluePlexus). The core of the vulnerability isn't complicated, but its scope deserves attention: under certain configurations, LLM could send your configured OpenAI API Key to third-party compatible endpoint providers.

rss source: llm 0.37.2

Vulnerability Background: The Convenience and Risks of extra-openai-models.yaml

LLM supports connecting to OpenAI-compatible API endpoints provided by other vendors through the extra-openai-models.yaml configuration file. This mechanism was taken over in version 0.37 by the newly added llm openai endpoint add command. The convenience is that users can call models from different providers using the same CLI and prompt workflow; the risk is that once the boundaries between configuration items blur, keys can flow to places they shouldn't go.

According to Simon Willison's release notes, Daniel reported two paths that could cause keys to be inadvertently sent out. Neither path is an attacker-actively-exploited vulnerability chain; rather, they are "silent leaks" arising from combinations of configuration and parameters—users often don't realize the key has already been sent, which is exactly what makes them dangerous.

OpenAI-compatible API endpoints refer to third-party service providers (such as Together, Groq, Fireworks, local vLLM/Ollama, etc.) that mimic OpenAI's /v1/chat/completions, /v1/models and other interface conventions, allowing existing SDKs or clients to call them by simply replacing base_url. The benefit is ecosystem reuse: prompt formats, streaming responses, and tool-calling parameters can all be carried over. But the cost is that authentication semantics are interpreted by each vendor individually—OpenAI uses Authorization: Bearer <key>, and while some compatible endpoints accept the same request header, they expect a key they themselves issued. Therefore, the client must accurately determine "which key should be carried on the current request." Once that judgment fails, the credentials in the request header are actually sent to the peer server along with the HTTP request, and typically only leave traces in server logs—users can hardly notice it locally.

Specific Causes of the Two Leak Paths

Path One: An Unstored api_key_name

The first case is when the key specified via api_key_name in the configuration has never actually been stored. In this state, LLM's handling logic may fall back to using the configured OpenAI API Key, thereby sending this real OpenAI key to the third-party endpoint. In other words, the user thinks they are pointing to a non-existent local key name, but what is actually sent is their most sensitive key.

api_key_name is an indirect reference field in LLM configuration: it is not the key itself, but the name of an entry stored in the local credential store (usually the OS keychain or ~/.config/io.datasette.llm/keys.json) via llm keys set <name>. The design intent is to allow configuration files to be safely committed or shared while keeping real keys local. Under normal flow, LLM looks up the key by name and injects it into the request; the problem is that when the lookup fails (typo in the name, never set, not migrated after switching machines), some code paths do not immediately throw an error but instead fall into the fallback branch of "default OpenAI key." As a result, the "reference" in the configuration is silently replaced with a real, valid, and more privileged OpenAI production key, which is then sent to the third-party endpoint with the request.

Path Two: A responses Model Combined with the chat_completions Parameter

The second case is when a model marked responses: true is run with the -o chat_completions 1 parameter, which can likewise send the OpenAI API Key to a third-party provider. This is a path mismatch caused by inconsistency between the model capability declaration and runtime parameters—the user explicitly switched the calling protocol, but the key selection logic was not tightened accordingly.

The common point of the two paths is that both occur in the scenario of "using a third-party compatible endpoint," and the leaked object is precisely the OpenAI key. For developers using multiple providers simultaneously, this kind of cross-vendor key misuse is an easily overlooked security blind spot.

-o chat_completions 1 is LLM's model option (-o/--option) syntax, used to override a field in the model metadata at runtime; here it means forcing the call to use the Chat Completions protocol instead of the Responses protocol. In recent years, OpenAI introduced the Responses API as a new-generation interface, whose request body, state management, and streaming events all differ from Chat Completions; the responses: true mark declares that the model uses the Responses path. When a user uses -o to forcibly switch the protocol, the request construction logic enters another branch, and if key selection is still determined according to the model's original declaration, a mismatch occurs where "the protocol has switched but the credentials have not been synchronized." This state space generated by combinations of metadata and runtime overrides is exactly where configuration-oriented tools are most prone to missing test coverage.

Fix and Upgrade Recommendations

Version 0.37.2 fixes the above two paths, corresponding to two security advisories, GHSA-v9h7-jj4g-f862 and GHSA-r639-rr7r-x72w. The advisories provide complete technical details, and developers currently using extra-openai-models.yaml or llm openai endpoint add are advised to consult them directly.

From an engineering perspective, this incident offers a lesson worth remembering: when a tool introduces an indirection layer from "key name to actual key" to facilitate multi-vendor switching, the fallback logic must fail explicitly rather than silently using the default key. Silent fallback may seem friendly functionally, but from a security standpoint it is the worst possible default.

Implications for Multi-Model Toolchains

The value of tools like LLM lies in bringing models from different vendors into the same workflow, but this also means a single configuration error can affect the account security of multiple service providers at once. For developers who regularly use compatible endpoints, it is recommended to proactively check your extra-openai-models.yaml after upgrading, confirming that every api_key_name corresponds to a genuinely stored key and avoiding reliance on any implicit fallback behavior.

The security advisory numbers and reporter information have all been made public, providing a reusable reference for authors of other similar tools: code paths involving cross-provider credential passing need dedicated test cases covering the two boundary conditions of "key does not exist" and "protocol parameter conflict."

One-line Summary

LLM 0.37.2 fixes a security issue in which OpenAI keys could be silently sent to third-party compatible endpoints under two configuration paths.

Paragraph Summary

Simon Willison's LLM command-line tool has released 0.37.2, fixing two security advisories (GHSA-v9h7-jj4g-f862 and GHSA-r639-rr7r-x72w) reported by security researcher Daniel de Araujo (BluePlexus). The problem occurs in scenarios where third-party OpenAI-compatible endpoints are connected via extra-openai-models.yaml or llm openai endpoint add: first, when the key referenced by api_key_name has never been stored, the logic may fall back to using the real OpenAI API Key and send it to a third party; second, when a model marked responses: true is run with -o chat_completions 1, it may likewise send the OpenAI key outward. Both paths are silent leaks arising from combinations of configuration and parameters that are hard for users to notice. The fix direction is to make key fallback fail explicitly rather than silently using the default key. The author recommends that users, after upgrading, verify that every api_key_name in their configuration corresponds to a genuinely stored key.

#LLM 0.37.2#API Key leak#OpenAI compatible endpoint#extra-openai-models.yaml#Simon Willison#security vulnerability
Share:

Related articles