Skip to main content
Menu
Advisories

memory_export writes to an arbitrary path and memory_import reads one

GHSA-VQPP-QH58-2P7HPublished Updated GitHub

Description

Impact

Write. memory_export (v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts, around lines 1726 and 1802) calls writeFileSync(outputPath, …) with no validatePath and no workspace containment. An MCP caller can overwrite any file the user can write. If the caller first stores a value containing shell syntax and exports into a file the shell reads at startup (~/.bashrc), the JSON line runs as a command on the user's next shell. ~/.ssh/authorized_keys and other config files can also be overwritten.

Read. memory_import (around lines 1844-1846) reads any inputPath and echoes the JSON parse error, which includes the first bytes of a non-JSON file such as /etc/passwd.

Database path. dbPath (resolveDbPathOption) is resolved without containment in every memory tool.

This is the same class as the session_export path traversal fixed in #4671 (d369bb73b); this sibling was missed.

Fix

Apply the realpath containment helper from the session_export fix to outputPath, inputPath and dbPath, refuse symlinks, and return a generic parse error.

Affected versions

References

GitHub · ruvnet/ruflo