Back to plugin

Security audit

memsearch — OpenClaw Plugin

Security checks for vulnerabilities and agentic risk

Overview

ClawScan rates memsearch suspicious because it reports risks of private conversation data being exposed across audiences and of untrusted content reaching an agent with broader capabilities than summarizing requires; this is not a finding that the author acted maliciously.

Consider whether private conversations and shared audiences use the same agent or workspace, and whether the host limits the native agent's tools and environment. The scanner reports potential disclosure and prompt-injection risks whose impact depends on host configuration, so review the plugin's access and isolation settings before installing.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (2)

MCP07

Error
Location
index.ts:837
Finding

Private Memory Recall and Search Lack Conversation-Audience Authorization ## Remediation Suggestions 1. Introduce a common host-backed authorization function for automatic recall, search, and expansion. 2. Restrict owner-private memories to the matching authorized owner-private audience. Fail closed when the required audience identity cannot be established. 3. Partition memory storage and collections by trusted audience identity, or attach trusted audience metadata to each record and enforce server-side retrieval filters. 4. Apply the host’s sandbox, workspace-confinement, incognito, and session-visibility restrictions where relevant. Do not treat a shared workspace as authorization. 5. Recheck invocation and audience validity immediately before injecting context or returning tool results. 6. Add regression tests covering private-to-group disclosure, shared workspaces, missing audience metadata, and audience changes during asynchronous execution.

Content
View full analysis

Vulnerability Details

File Location: plugin/index.ts:837–856 (automatic recall), plugin/index.ts:661–715 (memory search), and plugin/index.ts:725–769 (memory expansion). Corresponding handlers are present in the loaded entry point, plugin/index.js.

Vulnerability Type: Missing authorization; sensitive conversation disclosure
Risk Level: High

Vulnerable Code

Automatic recall reads workspace memory and prepends it to the current conversation without verifying its audience:

typescript
api.on("before_prompt_build", async (_event: any, ctx: any) => {
  updateAgentContext(ctx);
  const promptProjectDir = projectDir;
  const promptMemoryDir = memoryDir;
  try {
    const context = getRecentMemories(promptMemoryDir);
    const skillHint = await getSkillCandidateHint(promptProjectDir);
    const blocks = [context, skillHint].filter(Boolean);
    if (blocks.length > 0) {
      return { prependContext: blocks.join("\n\n") };
    }
  } catch (e: any) {
    logger?.warn?.(
      `[memsearch] Failed to inject memories: ${e.message}`
    );
  }
  return {};
});

The search execution path likewise returns results from the workspace collection without checking the current conversation audience:

typescript
async execute(
  _toolCallId: string,
  params: { query: string; top_k?: number }
) {
  const topK = params.top_k || 5;
  try {
    const cmd = await getMemsearchCmd();
    const collection = await getCollectionName(toolProjectDir);
    const result = await runCmd(
      [
        "bash", "-c",
        `${cmd} search '${shellEscape(params.query)}' ` +
          `--top-k ${topK} --json-output --default-collection ${collection}`,
      ],
      { timeoutMs: 30000, cwd: toolProjectDir }
    );
    const failure = commandFailure("Search", result);
    if (failure) {
      return { content: [{ type: "text" as const, text: failure }] };
    }
    const output = result.stdout || result.stderr || "No results";
    return { content: [{ type: "text
...[truncated 2425 chars]

MCP06

Error
Location
index.ts:941
Finding

Native Summarization and Maintenance Process Untrusted Content Through an Unrestricted Agent ## Remediation Suggestions 1. Replace native agent invocation with stateless, tool-free model inference for summarization and maintenance. 2. If a child agent must be used, create a dedicated isolated profile that disables command execution, filesystem access, network actions, transcript access, and unrelated tools. 3. Pass a minimal environment allowlist rather than inheriting the entire gateway environment. Supply only credentials strictly required for the selected inference provider. 4. Keep task instructions separate from conversation and journal data. Explicitly label supplied content as untrusted evidence, while recognizing that prompt wording does not replace capability restrictions. 5. Use fresh maintenance sessions rather than the fixed `memsearch-maintenance` session identifier. 6. Validate structured output, constrain output size, and treat persisted summaries as untrusted data during subsequent recall. 7. Test with hostile transcript and journal instructions. Verify that no tool calls or external side effects are possible, regardless of generated text.

Content
View full analysis

Vulnerability Details

File Location: plugin/index.ts:941–949 (native summarization), corresponding runtime code in plugin/index.js:726–738, and plugin/scripts/maintenance-runner.py:245–252 (native maintenance).

Vulnerability Type: Prompt injection; excessive agent authority
Risk Level: High

Vulnerable Code

The native summarizer combines instructions and conversation content into a message passed to an ordinary OpenClaw agent:

typescript
const msgText = `${systemPrompt}\n\nTranscript:\n${turnText}`;
const tmpFile = `/tmp/memsearch-summarize-${randomUUID()}.txt`;
const modelArg = summarizeModel ? ` --model '${shellEscape(summarizeModel)}'` : "";
const shellCmd = `openclaw agent --local --session-id ${randomUUID()}${modelArg} -m '${shellEscape(msgText)}' > ${JSON.stringify(tmpFile)} 2>/dev/null`;
await runCmd(["bash", "-c", shellCmd], {
  timeoutMs: 60000,
  cwd: captureProjectDir,
  env: envWithOverrides({ MEMSEARCH_NO_WATCH: "1", MEMSEARCH_DISABLE: "1" }),
});

The OpenClaw maintenance provider also launches an ordinary agent without a tool-free execution boundary:

python
if ctx.platform == "openclaw":
    cmd = ["openclaw", "agent", "--local", "--session-id", "memsearch-maintenance"]
    if model:
        cmd += ["--model", model]
    cmd += ["-m", prompt]
    env["MEMSEARCH_DISABLE"] = "1"
    return extract_task_json_output(run_command(cmd, env=env, cwd=ctx.project_dir, timeout=120))

Technical Analysis

Summarization requires text generation, but the plugin invokes the native agent rather than a stateless, tool-free inference interface. The invocation does not select an isolated profile or explicitly remove filesystem, execution, network, transcript, or other agent tools.

Conversation text is concatenated with the summarization instructions in the same message. Attacker-controlled content can therefore attempt to redirect the child agent from recording notes into performing actions. The supplied note-taking inst ...[truncated 2593 chars]

SkillSpector was not run because this plugin release contains no bundled skills.

Endor dependency reachability

Checked Nov 10, 2026 · 4:19 AM UTC

No reachable vulnerabilities reported

Endor dependency scan completed.