CVE-2026-116575
Unescaped user_id/agent_id/run_id allow session_scope key collision, exposing cross‑tenant data.
- CVSS 6.3
- CWE-200
- Input Validation and Sanitization
- Remote
Mem0 provides persistent memory infrastructure for AI agents and applications. Prior to Python SDK 2.0.18 and TypeScript SDK 3.1.6, _build_session_scope() in mem0/memory/main.py and Memory.buildSessionScope() in the TypeScript SDK join caller-controlled user_id, agent_id, and run_id values using unescaped & and = delimiters. A caller can embed another scope component in a controlled identifier so that distinct tenant tuples produce the same session_scope key. Memory.add(), AsyncMemory.add(), and the REST POST /memories flow use that key to read and save recent raw messages, allowing cross-tenant conversation disclosure and eviction or interleaving of another tenant's history. This issue is fixed in Python SDK 2.0.18 and TypeScript SDK 3.1.6.
- CWE
- CWE-200
- CVSS base score
- 6.3
- Published
- 2026-10-26
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Direct Object References (IDOR)
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- Python SDK, TypeScript SDK
- Fixed by upgrading
- Yes
Solution
Upgrade to Python SDK ≥ 2.0.18 and TypeScript SDK ≥ 3.1.6.
Vulnerable code sample
import urllib.parse
def _build_session_scope(user_id: str, agent_id: str, run_id: str) -> str:
# VULNERABLE: unescaped concatenation allows IDOR
return f"user_id={user_id}&agent_id={agent_id}&run_id={run_id}"Patched code sample
import urllib.parse
def _build_session_scope(user_id: str, agent_id: str, run_id: str) -> str:
# FIX: escape components to prevent key collisions
safe_user = urllib.parse.quote_plus(user_id, safe='')
safe_agent = urllib.parse.quote_plus(agent_id, safe='')
safe_run = urllib.parse.quote_plus(run_id, safe='')
return f"user_id={safe_user}&agent_id={safe_agent}&run_id={safe_run}"Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- fix(memory): escape delimiters when building the session scope key (#6892) (mem0ai/mem0)
mem0/memory/main.py,mem0/memory/main.py · _build_session_scope
Cite this entry
@misc{vaitp:cve2026116575,
title = {{Unescaped user_id/agent_id/run_id allow session_scope key collision, exposing cross‑tenant data.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-116575},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-116575/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
