Back to skill

Security audit

Openclaw Memory Enhancer

Security checks for vulnerabilities and agentic risk

Overview

This memory skill has a coherent purpose, but it relies on unreviewed remote code and can feed persistent memory contents back into future prompts without clear trust boundaries.

Review the upstream code before use, prefer a pinned commit or audited package, and install dependencies in an isolated environment. Do not store credentials, private keys, confidential notes, or untrusted instructions in the memory directory unless the implementation adds filtering and clear user control over what is recalled into prompts.

Vulnerability Patterns
  • 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
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:153
Finding

Persistent Memory Content Is Injected Into LLM Prompts Without Trust Boundaries

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 153–185
Vulnerability Type: Persistent prompt injection through recalled memory
Risk Level: High

Vulnerable Code

python
class EnhancedAgent:
    def __init__(self):
        self.memory = MemoryEnhancerEdge()
        self.memory.load_openclaw_memory()
    
    def process(self, user_input: str) -> str:
        # 1. Recall relevant memories
        memory_context = self.memory.recall_for_prompt(user_input)
        
        # 2. Enhance prompt with context
        enhanced_prompt = f"""
{memory_context}

User: {user_input}
"""
        
        # 3. Call LLM with enhanced context
        response = call_llm(enhanced_prompt)
        
        return response

The documented memory types also explicitly include persistent instructions:

text
| `instruction` | Direct instructions | "Remember: always do X" |

The skill additionally states at line 23 that it automatically reads all files from the memory/ directory.

Technical Analysis

The documented integration loads persistent memory, retrieves entries related to the current request, and interpolates the retrieved content directly into the prompt sent to the LLM. The design does not describe any provenance validation, authorization checks, prompt-injection filtering, content escaping, or structural separation between trusted agent instructions and untrusted recalled data.

Because the supported memory types explicitly include direct instructions, an attacker-controlled memory entry can be interpreted as an instruction rather than passive reference material. Automatic ingestion of all files in the memory directory expands the trust boundary to any user, process, plugin, or compromised component capable of writing there.

This creates a persistent indirect prompt-injection condition: malicious content can remain in long-term storage and influence later sessions when semantic retrieval selects it.

Attack Path

  1. An attack ...[truncated 1407 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat all recalled memory as untrusted data, never as agent instructions.
  2. Place recalled content in a dedicated, strongly delimited data field and add a higher-priority instruction stating that memory content must not override system or developer policy.
  3. Reject, quarantine, or require explicit approval for instruction-like memory entries, especially entries originating from chats, imported files, plugins, or external integrations.
  4. Record provenance, creator identity, creation time, integrity metadata, and trust level for every memory entry.
  5. Restrict memory-directory permissions according to least privilege and prevent unrelated plugins or processes from writing to it.
  6. Use an allowlist for accepted files and exclude symbolic links, unexpected file types, oversized files, and files outside the canonical memory directory.
  7. Apply prompt-injection detection and content normalization before indexing and again before prompt construction.
  8. Limit how much recalled content can be inserted and redact secrets or sensitive personal information before sending prompts to an LLM.
  9. Require user confirmation before recalled content can trigger consequential tools, external communication, file modification, or credential use.
  10. Add adversarial tests covering persistent instructions, cross-session poisoning, hidden directives, and malicious content embedded in imported memory files.

T03 · Remote Payload Retrieval and Execution

Warning
Location
SKILL.md:95
Finding

Mutable External Repository Content Is Retrieved for Local Execution

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 95–96
Vulnerability Type: Unpinned remote payload retrieval
Risk Level: Medium

Vulnerable Code

bash
git clone https://github.com/henryfcb/openclaw-memory-enhancer.git \
  ~/.openclaw/skills/openclaw-memory-enhancer

The documentation subsequently directs users to execute scripts obtained from this installation, including:

bash
python3 memory_enhancer_edge.py --load

Technical Analysis

The installation instructions clone the current state of a remote repository without selecting a reviewed commit, immutable release tag, checksum, or cryptographic signature. The effective code installed by this command can therefore change after the skill documentation has been audited.

The supplied project contains only SKILL.md; it does not contain the referenced Python scripts. Consequently, the behavior of the code users are instructed to run cannot be verified from the audited artifact. If the repository, maintainer account, release process, or upstream hosting path is compromised, arbitrary replacement code could be delivered and executed under the user's account.

Attack Path

  1. An attacker compromises the upstream repository, its maintainer account, or its publishing workflow.
  2. The attacker modifies memory_enhancer_edge.py or another imported module in the repository.
  3. A user follows the documented git clone command, receiving the attacker-controlled current revision.
  4. The user runs python3 memory_enhancer_edge.py --load as instructed.
  5. The malicious Python code executes with the user's operating-system permissions and access to the OpenClaw workspace.

Impact Assessment

A malicious remote revision could read or modify files accessible to the user, access OpenClaw memory and configuration, steal locally available credentials, make network requests, or modify other user-level components. Its maximum scope is bounded by the privileges of the user execut ...[truncated 242 chars]

Remediation
View remediation

Remediation Suggestions

  1. Include the reviewed implementation files in the skill package so the executed code is part of the audited artifact.
  2. Pin repository installation to a specific reviewed commit SHA rather than the mutable default branch.
  3. Publish and verify cryptographic checksums or signed release artifacts before execution.
  4. Protect releases with signed tags, branch protection, mandatory review, and hardened maintainer accounts.
  5. Document the expected commit and integrity value directly in the installation instructions.
  6. Run downloaded code in a dedicated, least-privileged environment without unnecessary access to credentials or unrelated workspace files.
  7. Re-audit the complete pinned source, including transitive imports and installation hooks, before deployment.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:74
Finding

Python Dependencies Are Installed Without Version or Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 74
Vulnerability Type: Unpinned third-party dependencies
Risk Level: Medium

Vulnerable Code

bash
pip install sentence-transformers numpy

Technical Analysis

The installation command does not constrain package versions or verify artifact hashes. It therefore resolves whatever compatible package versions and transitive dependencies are available from the configured package index at installation time.

This prevents reproducible installation and means the dependency set may differ from the one reviewed or tested by the skill author. Compromise of an upstream package or release account, unsafe package-index configuration, dependency substitution, or a malicious transitive release could introduce code that runs during installation or later import.

The artifact does not show dependency confusion or a known malicious package. The confirmed issue is the absence of version and integrity controls around third-party executable components.

Attack Path

  1. A dependency or transitive dependency publishes a compromised release, or the user's package-index configuration resolves an attacker-controlled artifact.
  2. The user executes the documented unpinned pip install command.
  3. Pip selects and installs the malicious or unexpectedly changed package version.
  4. Package installation hooks or subsequent Python imports execute attacker-controlled code.
  5. The code operates with the permissions and accessible data of the user running the skill.

Impact Assessment

A compromised Python dependency could execute arbitrary code in the installation environment, access files and environment variables available to the user, inspect OpenClaw data, or communicate over the network. The scope is bounded by the installer's operating-system privileges and environment isolation.

The lack of a lockfile also creates reliability and compatibility risks, although those concerns are secondary to the su ...[truncated 20 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin all direct dependencies to reviewed versions.
  2. Generate a lockfile that includes the complete transitive dependency graph.
  3. Require hashes for every downloaded wheel, for example through a hash-locked requirements file and pip install --require-hashes.
  4. Prefer binary wheels from trusted sources and disable unnecessary source builds.
  5. Use an isolated virtual environment with no access to unrelated credentials or system packages.
  6. Scan pinned dependencies for known vulnerabilities and establish an explicit, reviewed update process.
  7. Configure trusted package indexes explicitly and prevent fallback to untrusted or unintended indexes.
  8. Document that installation and model acquisition require network access; qualify the claims at lines 208–209 that there are no network requests or external API calls.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly advertises that it automatically reads all files from the memory directory and injects recalled memories into future prompts, but it does not warn users that prior conversation content, preferences, or sensitive notes may be surfaced later. This creates a real privacy and prompt-context leakage risk, especially in shared workspaces or when memory files contain credentials, personal data, or confidential history.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 263)May include surrounding context.

Memory limit reached

The system automatically removes oldest memories when limit is reached.

To increase limit:

python

Static analysis

No suspicious patterns detected.