codebase-memory-mcp fixes query_graph stack out-of-bounds write, triggerable when a clause exceeds 32 items
codebase-memory-mcp: Stack out-of-bounds write in query_graph via a RETURN or WITH clause with more than 32 items
In codebase-memory-mcp (npm and pip packages) versions before 0.9.0, the Cypher parser does not limit the number of projection items in RETURN or WITH clauses, while the projection executor indexes fixed 32-element stack arrays by the parsed count; submitting a query with more than 32 projection items through the query_graph tool writes out of bounds to these arrays, and the relevant path that builds result columns reads uninitialized stack slots even when no node matches. A single tool parameter can cause stack memory corruption in the service process, reliably triggering a crash, with potentially more severe consequences depending on memory layout; any query_graph caller can reach it, including agents querying untrusted content affected by it. The vulnerability is fixed in 0.9.0, which checks the projection count before execution; the advisory recommends upgrading to v0.12.1, verified to contain the fix, where RETURN is capped at 32 items and WITH at 16 items, and clauses exceeding the limit are rejected rather than silently truncated. The vulnerability was reported privately by Aaron (@aaronjmars).
The advisory states that a single tool parameter can cause stack memory corruption in the service process, and agents querying untrusted content affected by it can also reach the vulnerability.