Back to skill

Security audit

Memory Manager

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local memory logger/search helper; its persistence has privacy implications, but the behavior is purpose-aligned and not deceptive or destructive.

Install only if you want conversations and selected insights persisted locally in the OpenClaw workspace. Avoid saving secrets or regulated data, periodically review and delete memory files, and treat retrieved memory as untrusted historical content rather than instructions.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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 (1)

T02 · Agent Memory Poisoning

Warning
Location
memory_manager.py:40
Finding
Persistent Agent Memory Poisoning Through Unsanitized Content## Vulnerability Details **File Location**: `memory_manager.py:40-49` and `memory_manager.py:61-70` **Vulnerability Type**: `T02: Agent Memory Poisoning` **Risk Level**: Medium ### Vulnerable Code ```python timestamp = datetime.now().strftime("%H:%M:%S") entry = f"\n## [{timestamp}]\n\n{content}\n" if metadata: entry += f"\n_Meta: {json.dumps(metadata, ensure_ascii=False)}_\n" with open(daily_file, "a", encoding="utf-8") as f: f.write(entry) return str(daily_file) ``` ```python timestamp = datetime.now().strftime("%Y-%m-%d %H:%M") if not self.memory_file.exists(): with open(self.memory_file, "w", encoding="utf-8") as f: f.write("# MEMORY.md - Long-term Memory Archive\n\n") with open(self.memory_file, "a", encoding="utf-8") as f: f.write(f"\n## [{timestamp}] {category}\n\n") f.write(f"{key_insights}\n") ``` ### Technical Analysis The `save_conversation()` method writes the caller-controlled `content` value verbatim to a daily memory file. Similarly, `update_longterm()` writes `key_insights` and the associated category directly into the long-term `MEMORY.md` archive. The implementation does not apply trust labels, structural isolation, instruction filtering, provenance validation, or escaping designed to distinguish untrusted conversation data from trusted Agent instructions. Because these files are explicitly intended for later memory retrieval and Agent use, attacker-controlled text can persist beyond the original interaction. If another component incorporates the stored Markdown into an Agent's prompt or context without treating it strictly as untrusted data, embedded instructions may be interpreted as directives rather than historical content. The issue is therefore a persistent indirect prompt-injection and memory-poisoning risk. The reviewed code does not itself prove that stored text is automatically executed as an instruction; exploitation depends on how the surroun ...[truncated 1529 chars]
Remediation
## Remediation Suggestions 1. Store memories as structured records containing explicit fields for content, source, timestamp, trust level, and whether the data was supplied by a user. 2. Mark all conversation-derived content as untrusted and ensure downstream prompts state that retrieved memory is reference data, not executable instructions. 3. Place retrieved content inside strongly delimited data sections and escape or encode formatting that could blur the boundary between instructions and stored text. 4. Do not automatically promote user-controlled content into `MEMORY.md`. Require a trusted review or a constrained extraction process that records factual summaries without retaining embedded directives. 5. Apply validation designed to detect instruction-like persistence attempts. Treat filtering as defense in depth rather than the sole protection. 6. Preserve provenance when returning search results so the consuming Agent can distinguish user statements from trusted system-generated memory. 7. Limit the quantity and scope of memory inserted into future prompts and avoid loading entire memory files into privileged Agent contexts. 8. Add security tests that save adversarial instructions, retrieve them in a later simulated session, and verify that they remain quoted as untrusted historical data rather than affecting Agent behavior.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The code generally matches the broad theme of long-term memory management, but key parts of the declared description overstate the implemented behavior. The search feature is not semantic; it is a straightforward case-insensitive text containment check over markdown files. Likewise, conversation archiving and organization are not clearly automatic beyond writing to date-named files when the save method or CLI is called. There are no undeclared risky capabilities such as network access, privilege use, or unrelated triggers, but the description is materially more capable than the implementation in these respects.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The function persistently stores user-provided conversation content and optional metadata to disk without any built-in consent, warning, minimization, or redaction controls. In an agent memory context, conversations often contain secrets, credentials, personal data, or regulated information, so silent archival meaningfully increases confidentiality and privacy risk if the host is shared, backed up, or later searched/exfiltrated.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This method appends user-derived 'key insights' into a long-term archive file (MEMORY.md) with no notice, approval workflow, or sensitivity checks. Because the skill is specifically designed for long-term agent memory, this context makes silent persistence more dangerous: high-value summaries can concentrate sensitive information into a durable, easy-to-search file that may outlive the original session expectations.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The manifest describes a memory system that provides semantic search, which implies meaning-based retrieval beyond literal term matching. The code in search_memory lowercases the query and checks whether it is a substring of file content and sections, with no embeddings, vector index, or semantic ranking.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
The module and manifest present the skill as offering semantic search, but the function documentation explicitly states 'Search memories using keyword matching.' This is an active contradiction between the documented intent of the skill and the implemented/documented behavior of the search routine.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill explicitly advertises automatic conversation logging but provides no warning about what data may be stored, how long it is retained, or whether sensitive content could be captured. In a memory-management skill, this increases the chance that users or operators unknowingly persist credentials, personal data, or confidential project information to local files.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
Documenting that the skill automatically saves conversations during agent operation without disclosing the user-data impact is a real security/privacy issue, not merely a documentation gap. Because the core function is persistent memory collection, silent auto-save can capture sensitive prompts, tokens, internal discussions, or regulated data, making accidental overcollection and retention more likely.

Static analysis

No suspicious patterns detected.