Back to skill

Security audit

Claw Memory Manager

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims, but its config-writing behavior can affect persistent memory, restart OpenClaw, and may expose or overwrite configuration files in managed environments.

Install only if you want this skill to change OpenClaw's persistent memory configuration. Use --dry-run first, consider --no-restart in shared or production environments, review/limit sensitive memories before enabling Active Memory or Dreaming, and avoid running it with elevated privileges or writable shared mirror directories until config-file permissions and symlink handling are hardened.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/agent_memory.py:178
Finding

Managed Configuration Mirrors May Be Created with Unsafe Permissions and Symlink Following

Content
View full analysis

Vulnerability Details

File Location: scripts/agent_memory.py, lines 178-180 and 225-232
Vulnerability Type: Insecure file creation and unsafe symbolic-link handling
Risk Level: Medium

Vulnerable Code

python
def save_config(cfg: dict, path: Path) -> None:
    with open(path, "w") as f:
        json.dump(cfg, f, indent=2, ensure_ascii=False)

The vulnerable function is used to write complete configuration data to managed mirror paths:

python
for dest in CONTAINER_SYNC_TARGETS:
    if dest.parent.exists():
        if dry_run:
            synced.append(f"{dest} (DRY-RUN)")
        else:
            try:
                save_config(cfg, dest)
                synced.append(str(dest))

Technical Analysis

save_config() opens the destination with Python's standard "w" mode without explicitly setting restrictive permissions or protecting against symbolic links.

When a managed mirror file does not exist, its permissions are derived from the process umask. In common environments, this can create a file with mode 0644, allowing other local users or container processes to read it. The script writes the complete OpenClaw configuration to each mirror, rather than only the modified memory settings. If that configuration contains API keys, access tokens, credentials, or other sensitive values, those values may therefore become locally accessible.

The operation also follows symbolic links. The script checks only whether the destination's parent directory exists; it does not verify that the destination is a regular file, reject symbolic links, or validate the ownership and permissions of the parent directory. If a less-trusted actor can modify one of the managed mirror directories, that actor could replace openclaw.json with a symbolic link before the script runs.

Attack Path

  1. An attacker obtains write access to /app/clawconfig/ or /app/k8s-config/clawconfig/.
  2. The attacker removes the expected openclaw.json mirr ...[truncated 1274 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create configuration files with an explicit restrictive mode such as 0600, rather than relying on the process umask.
  2. Use os.open() with appropriate flags, including O_WRONLY, O_CREAT, O_TRUNC, and O_NOFOLLOW where supported.
  3. Reject destinations that are symbolic links or non-regular files by validating them with lstat() before writing.
  4. Validate that each managed mirror directory has trusted ownership and is not writable by untrusted users or groups.
  5. Perform atomic writes:
    • Create a temporary file securely in the destination directory.
    • Apply mode 0600.
    • Write and flush the JSON data.
    • Call os.fsync() where durability is required.
    • Atomically replace the destination with os.replace().
  6. Preserve restrictive permissions when replacing an existing configuration file.
  7. Consider verifying the destination again immediately before replacement to reduce time-of-check/time-of-use exposure.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (11)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README says Active Memory injects relevant memories into the model context window, but it does not prominently warn that previously stored material may be surfaced into future prompts. That creates a real privacy and data-exposure risk, because sensitive data retained in memory can be reintroduced to model context and potentially influence downstream outputs or be disclosed unexpectedly.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README describes the capability as turning each memory feature into "one command," but it does not specify the exact invocation phrases, constraints, or exclusion conditions for when the skill should activate. In markdown skill documentation, this kind of broad activation framing can overlap with many generic requests to enable or manage memory features and may cause unintended invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README explains that Dreaming promotes top-scoring signals into persistent MEMORY.md, but it does not explicitly warn that this modifies long-lived user data automatically. Persistent writes are security-relevant because they can preserve sensitive, incorrect, or attacker-influenced content beyond the current session and affect future behavior.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 116)May include surrounding context.

md
- Python 3.8+
- OpenClaw 2026.4.24+ installed (`openclaw --version` to check)
- Write access to `~/.openclaw/openclaw.json`

Zero third-party Python dependencies (stdlib only).

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises and instructs use of shell execution, environment-variable-driven config selection, and filesystem writes to multiple config paths, but it does not declare any explicit tool scope such as permissions or allowed-tools. That creates a trust gap: an agent may invoke broader shell/file capabilities than a reviewer or user expects, enabling unintended config modification, restart actions, or writes to attacker-influenced paths like $OPENCLAW_CONFIG.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The markdown states that the skill automatically mirrors configuration to multiple filesystem paths and runs openclaw gateway restart by default. While the behavior is described, there is no explicit warning or caution to the user that enabling this feature will modify persisted config files and restart a running service, which can affect system integrity and availability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The Active Memory feature is documented as automatically retrieving memories and injecting them into every turn's context window, but the file provides no privacy or data-handling warning. In a memory-management skill, that omission is security-relevant because recalled memories may contain sensitive prior context that can be surfaced to downstream prompts, increasing unintended disclosure risk.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent_memory.py (reported line 256)May include surrounding context.

python
print("   📋 [DRY-RUN] Would run: openclaw gateway restart")
        return True
    try:
        result = subprocess.run(
            ["openclaw", "gateway", "restart"],
            capture_output=True, text=True, timeout=15,
        )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent_memory.py (reported line 271)May include surrounding context.

python
def check_version() -> str:
    try:
        r = subprocess.run(
            ["openclaw", "--version"], capture_output=True, text=True, timeout=5,
        )
        return r.stdout.strip() or "unknown"

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/agent_memory.py (reported line 344)May include surrounding context.

python
print(f"\n🔍 Checking support for {feature_name}")
    print(f"   OpenClaw version: {version}")
    try:
        r = subprocess.run(
            ["openclaw", "config", "schema.lookup", ".".join(feat["path"])],
            capture_output=True, text=True, timeout=10,
        )

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Documenting automatic gateway restart without a prominent warning understates service-impacting behavior. Restarting a gateway can interrupt active sessions, cause brief downtime, or surprise operators in shared environments, so users should be explicitly alerted before invoking a command that changes service state.

Content

No source excerpt is available for this finding.