Vulnerability Overview
A critical vulnerability identified as CVE-2026-65120 (CVSS v3.1 9.8) has been discovered in LiteLLM Proxy, the popular open-source AI gateway used by enterprises to manage, route, and load-balance calls across OpenAI, Anthropic, Bedrock, and Azure AI models. The vulnerability permits remote unauthenticated callers to execute arbitrary SQL commands against the underlying PostgreSQL/pgvector database via tainted metadata filter queries passed to vector retrieval endpoints.
Attack Mechanics & Code Breakdown
Enterprise deployments frequently configure LiteLLM Proxy to handle Retrieval-Augmented Generation (RAG) caching and semantic routing using an embedded vector store backend. When a client performs semantic search or document retrieval via POST /v1/embeddings/query, the service permits filtering results using dynamic metadata dictionaries.
Prior to version 1.52.4, the metadata query builder concatenated JSON keys directly into dynamic raw SQL query strings instead of using prepared statements or Prisma/SQLAlchemy parameterized bindings:
# Vulnerable raw SQL concatenation in LiteLLM vector query handler
query = f"""
SELECT doc_id, content, 1 - (embedding <=> '{vector}') AS similarity
FROM documents
WHERE tenant_id = '{tenant_id}' AND metadata->>'{filter_key}' = '{filter_val}'
"""
By injecting SQL metacharacters into the filter_key parameter (such as ' UNION SELECT null, secret_token, 1 FROM api_keys--), an attacker can extract plaintext upstream LLM API tokens, administrative gateway credentials, and proprietary prompt audit histories across all tenant boundaries.
Impact & Blast Radius
Because LiteLLM Proxy is typically deployed as a centralized hub holding credentials for enterprise cloud providers (AWS Bedrock keys, Azure OpenAI API secrets, and Claude workspace tokens), database compromise exposes all integrated cloud AI accounts to unauthorized draining and lateral data theft.
Defensive Playbook & Remediation
| Component | Vulnerable Version | Fixed Release | Action Required |
|---|---|---|---|
| LiteLLM Core Proxy | < 1.52.4 | 1.52.4 or later | Deploy container image update; verify parameterized queries |
| PostgreSQL Database | All unsegmented | Role restricted | Drop SUPERUSER rights; enforce read-only role on vector queries |
| API Token Storage | Plaintext columns | Vault / KMS encrypted | Enable database field-level encryption for provider secrets |
Vulnerable Software Versions & Patch Status Matrix
| AI Package / Model Serving Module | Vulnerable Versions | Fixed / Remediated Release | Remediation Action Required |
|---|---|---|---|
| CVE-2026-65120 | Versions prior to security hotfix | Latest Patched Release | Update package dependencies via pip/npm and redeploy |
| Agent Tool Calling Runtime | Unsandboxed local process execution | MicroVM / Container Sandboxing | Enforce strict schema validation on input parameters |
Step-by-Step Remediation Playbook & Python / Shell Commands
AI infrastructure engineers and developers must apply updates and secure model orchestration pipelines:
- Upgrade Package Dependencies via Pip / Poetry:
# Upgrade Python packages to the latest remediated release pip install --upgrade --no-cache-dir "cve-2026-65120>=latest" # Verify installed package version pip list | grep -E "cve-2026-65120|torch|transformers|mcp" - Enforce Ephemeral Sandbox Isolation for Agent Tool Execution:
# Execute agent tool calls inside rootless gVisor sandbox container docker run --rm --runtime=runsc --network=none --cap-drop=ALL --security-opt no-new-privileges -v /tmp/agent_input:/input:ro alpine:latest /bin/sh -c "exec /bin/tool" - Validate Input Arguments against Strict Regex Allowlist:
# Defensive parameter validation snippet for MCP / agent tool calling import re def validate_tool_argument(param: str) -> str: # Reject shell metacharacters and directory traversal patterns if not re.match(r"^[a-zA-Z0-9_.-]+$", param): raise ValueError(f"Malicious tool parameter rejected: {param}") return param
Threat Detection & Agentic Log Auditing Queries
Audit AI inference logs for signs of indirect prompt injection and anomalous tool invocation arguments:
# Grep agent execution logs for command chaining metacharacters in tool calls
grep -E "tools/call.*[;&|`$]" /var/log/ai_agent/execution.log
# Inspect systemd journal for unexpected subprocess execution from AI daemons
journalctl -u ai-agent-daemon --since "24 hours ago" | grep -i "exec"



