Advisories for Npm/Codebase-Memory-Mcp package

2026

codebase-memory-mcp: Stack out-of-bounds write in query_graph via a RETURN or WITH clause with more than 32 items

Before 0.9.0 the Cypher parser did not bound the number of projection items in a RETURN or WITH clause, while the projection executors indexed fixed 32-element stack arrays with a loop bounded by the parsed count. A query with more than 32 projection items written through the query_graph tool wrote past those arrays. A related path read uninitialized stack slots when building result columns, even when no node matched.

codebase-memory-mcp: Heap buffer overflow on artifact import via int-truncated decompression capacity

When a repository contains a .codebase-memory/ artifact, indexing it imports the artifact automatically. Before 0.9.0 the decompression buffer was allocated with the 64-bit original_size from the attacker-controlled artifact.json, but the capacity handed to the Zstandard decompressor was truncated to int. A size with bit 31 set became negative, was sign-extended back to a huge size_t, and the decompressor wrote the frame's full content past the real allocation.

codebase-memory-mcp: git option injection through base_branch in detect_changes allows writing a file outside the project

Before 0.9.0 the base_branch argument of the detect_changes tool was checked for shell metacharacters but not for a leading dash. The value was placed in the revision position of a git diff invocation, so a value shaped like a git option was honoured by git. An option such as –output=<path> made git write its diff to a caller-chosen file.