CVE-2026-136146 — vanna-ai vanna — CWE-20 · CWE-502
A security flaw has been discovered in vanna-ai vanna 2.0.0/2.0.1/2.0.2. Affected by this vulnerability is the function _load_index of the file src/vanna/integrations/faiss/agent_memory.py of the component FAISS AgentMemory Integration. Performing a manipulation results in deserialization. The attack needs to be approached locally. The exploit has been released to the public and may be used for attacks. The vendor was contacted early about this disclosure but did not respond in any way.
A security flaw has been discovered in vanna-ai vanna 2.0.0/2.0.1/2.0.2. Affected by this vulnerability is the function _load_index of the file src/vanna/integrations/faiss/agent_memory.py of the component FAISS AgentMemory Integration. Performing a manipulation results in deserialization. The attack needs to be approached locally. The exploit has been released to the public and may be used for attacks. The vendor was contacted early about this disclosure but did not respond in any way.
🎯 What is this vulnerability?
This vulnerability is a Local Deserialization of Untrusted Data flaw (CWE-502) combined with Improper Input Validation (CWE-20) in the vanna-ai library, specifically within the FAISS integration module.
Technical Breakdown:
- Location:
src/vanna/integrations/faiss/agent_memory.py, function_load_index. - Mechanism: The
_load_indexfunction is responsible for loading pre-computed vector indices from disk (typically.faissor.indexfiles) into memory. The vulnerability arises because this function likely uses a deserialization method (such as Python'spickle,shelve, or a custom binary loader) that does not sufficiently validate the integrity or origin of the data being loaded. - The Flaw: If an attacker can place a maliciously crafted index file in the directory where
vannaexpects to find its memory indices, and then trigger the_load_indexfunction (e.g., by starting the agent or reloading memory), the deserialization process will execute arbitrary code embedded within the malicious file. - Why Local (AV:L)? The attack vector is Local because the attacker must have write access to the filesystem location where the FAISS index files are stored. This typically implies the attacker already has low-privileged local access (e.g., a compromised service account, a local user on the same host, or a container escape scenario where the volume is mounted).
- Identify Software: Use
pip list | grep vannaor inspectrequirements.txt/pyproject.tomlto confirmvanna-aiversion is 2.0.0, 2.0.1, or 2.0.2. - Locate Data Directory: Identify the path where
vannastores its FAISS indices. By default, this is often a local directory like./faiss_index/or a user-defined path in the configuration. - Verify Permissions: Confirm that the current user (or the service account running the application) has read access to this directory, and that the attacker has write access to it (or can overwrite existing files).
⚡ Attack Chain
1. Discovery & Reconnaissance
2. Exploitation
The attacker crafts a malicious Python pickle file that contains a payload to execute a system command upon deserialization.Illustrative PoC (Python):
import pickle
import os
class Exploit:
def __reduce__(self):
# This will execute 'id' when the object is unpickled
return (os.system, ('id > /tmp/pwned.txt',))
# Create a malicious pickle file
with open('malicious_index.faiss', 'wb') as f:
pickle.dump(Exploit(), f)Deployment:
1. The attacker writes malicious_index.faiss to the target directory, replacing or adding to the existing index files.
2. The attacker triggers the application to load the index. This could be done by:
* Restarting the service.
* Calling an API endpoint that initializes the agent memory (e.g., POST /api/agent/init).
* Waiting for an automatic reload if the application monitors file changes.
Note: The exact filename expected by _load_index depends on the application's configuration. If the application expects index.faiss, the attacker must overwrite that specific file.
3. Post-exploitation
_load_index calls pickle.load() on the malicious file, the __reduce__ method of the Exploit class is invoked, executing the os.system command.root or a privileged service account, the attacker gains those privileges.🌍 Real World Impact
vanna is used in a production AI pipeline, the attacker can manipulate the agent's memory, leading to incorrect or malicious responses.
* Lateral Movement: If the host is part of a larger network, the attacker can use the compromised host to pivot to other systems.
* Supply Chain Risk: If vanna is used in a SaaS platform, a single compromised instance could affect multiple customers if data is shared or if the attacker can exfiltrate customer data.🛡️ Remediation & Mitigation
1. Upgrade
vanna-ai where the _load_index function has been patched to validate the integrity of the index file (e.g., using a secure serialization format or verifying checksums).pip install --upgrade vanna-ai2. Workarounds
FAISS AgentMemory component in the configuration.chown -R appuser:appgroup /path/to/faiss_index
chmod 750 /path/to/faiss_index_load_index function to use a safer deserialization method (e.g., json if the format allows, or verify the file signature before loading).3. Detection
auditd, osquery, or Tripwire.
Rule: Alert on any write operation to .faiss or *.index files outside of the application's normal update cycle.
sysmon, auditd.
* Rule: Alert if the Python process spawns /bin/sh, /bin/bash, or other shell interpreters.
⚠️ Urgency
vanna-ai in a production environment with local access from multiple users or services, treat this as High priority. Patch immediately.