Summary
A pre-authentication code injection vulnerability in ChromaDB allows arbitrary code execution on the server when a malicious model repository is accepted with trust_remote_code enabled.
An unauthenticated attacker can exploit the collections API endpoint to load untrusted code from a remote repository, leading to full system compromise under typical deployment conditions.
Affected context
This vulnerability appears in ChromaDB deployments that expose the /api/v2/tenants/{tenant}/databases/{db}/collections endpoint and allow clients to specify model repositories with trust_remote_code set to true.
It becomes relevant in environments where the ChromaDB server runs with sufficient privileges and outbound network access to fetch remote model code, especially when no strict validation or allowlisting is enforced on model sources.
Exploit preconditions
- Attack surface: Public or internal HTTP API at
/api/v2/tenants/{tenant}/databases/{db}/collections - Required access: No prior authentication; attacker only needs network reachability to the ChromaDB server
- Trigger point: Submission of a collection configuration referencing a malicious model repository with
trust_remote_code=true - Why exploitation is possible: The server trusts client-supplied repository URLs and the
trust_remote_codeflag, causing loading and execution of remote, unvalidated code within the server process
Why this happens
The core issue is the unsafe execution of user-controlled code sources, mapping to CWE-94: Improper Control of Generation of Code (Code Injection).
By honoring trust_remote_code=true from client input and dynamically loading code from arbitrary repositories, the server treats untrusted configuration as executable logic.
The pattern is an insecure design where runtime code loading is directly influenced by API parameters without stringent trust boundaries, validation, or restrictions on permissible sources.
Potential impact
- An attacker can execute arbitrary code with the privileges of the ChromaDB server process
- Full compromise of stored data, including reading, modifying, or deleting collections
- Use of the compromised server as a pivot for lateral movement within the hosting environment
- Deployment of backdoors or malicious payloads, enabling persistent access
- Potential supply-chain style impacts if the service is part of a larger AI or data processing pipeline
General mitigation guidance
Mitigation centers on removing the ability for untrusted clients to influence code-loading behavior and tightening trust boundaries around model repositories.
Common defensive patterns include:
- Treating all remote code as untrusted by default and disallowing client-controlled
trust_remote_codeflags - Restricting model loading to vetted, allowlisted repositories managed by operators rather than users
- Introducing strict validation and schema controls on collection creation requests, rejecting any parameters that imply dynamic code execution
- Running the server with least privilege and applying process-level isolation to reduce the blast radius of any code execution paths
- Segregating configuration that affects runtime code from user-facing APIs, keeping such controls in operator-managed settings
How teams detect issues like this
Detection efforts can focus on both code-level indicators and runtime behavior.
At development time, static analysis and code review can flag dynamic import or trust_remote_code flows tied directly to HTTP request parameters or other user input.
Policy enforcement in CI/CD can require explicit justification or secure wrappers for any remote code-loading mechanisms.
At runtime, monitoring for unusual outbound connections to arbitrary repositories, unexpected module loading patterns, or anomalous process behavior can help identify exploitation attempts or misuse of these features.

