Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

CVE-2026-77331: CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm Vulnerability ID: CVE-2026-77331 CVSS Score: 2.0 Published: 2026-11-20 CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-st

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

Vulnerability ID: CVE-2026-77331
CVSS Score: 2.0
Published: 2026-11-20

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

TL;DR

A race condition (CWE-362) in the McpClientSearchAdapter component of memtomem-stm (< 0.1.34) causes concurrent RPC failures to trigger duplicate reconnect storms and allows mid-flight task cancellations to leave interrupted transport streams reusable. Upgrading to version 0.1.34 resolves the flaw by introducing monotonic session generation tracking and flight coalescing.

⚠️ Exploit Status: POC

Technical Details

  • Vulnerability ID: CVE-2026-77331 / GHSA-72jh-722p-rqr3
  • Weakness Class: CWE-362 (Race Condition / Improper Synchronization)
  • CVSS v4.0 Score: 2.0 (Low) - CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:L
  • Affected Component: McpClientSearchAdapter (src/memtomem_stm/surfacing/mcp_client.py)
  • Vulnerable Versions: memtomem-stm >= 0.1.2, < 0.1.34
  • Patched Version: memtomem-stm 0.1.34
  • Primary Impact: Duplicate reconnect storms, dirty transport session reuse, and local service degradation
  • Exploit / KEV Status: Unit Test PoC Available / Not Listed in CISA KEV

Affected Systems

  • memtomem/memtomem-stm
  • memtomem-stm: >= 0.1.2, < 0.1.34 (Fixed in: 0.1.34)

Code Analysis

Commit: 761db18

Implement generation-aware reconnect coalescing and dirty session tracking in McpClientSearchAdapter.

Exploit Details

  • GitHub: Official regression and reproduction unit tests in tests/test_mcp_client_reconnect.py demonstrating concurrent transport failures and mid-retry cancellations.

Mitigation Strategies

  • Upgrade memtomem-stm to version 0.1.34 or later to enable generation-bound session tracking and reconnect flight coalescing.
  • Serialize concurrent MCP adapter tool calls using an external asyncio semaphore if running an unpatched version.
  • Avoid aggressive caller-side asyncio task cancellation timeouts around memory surfacing operations to prevent mid-stream protocol interruptions.

Remediation Steps:

  1. Audit Python environments and dependency lockfiles (requirements.txt, pyproject.toml, poetry.lock) for memtomem-stm versions between 0.1.2 and 0.1.33.
  2. Run pip install --upgrade "memtomem-stm>=0.1.34" to install the patched release.
  3. Restart the memtomem-stm proxy gateway and verify in application logs that MCP transport reconnections complete without repetitive cascading warning entries.

References

Read the full report for CVE-2026-77331 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.