Back to skill

Security audit

OpenClaw Memory Fusion

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed OpenClaw memory manager, but its rollback feature can delete or overwrite arbitrary writable files if pointed at a crafted manifest.

Review this skill before installing. Use dry-run previews, avoid passing API keys unless you accept local config storage, avoid optional session memory unless you want conversation-derived memory retained, and do not run rollback with a manifest you did not create and inspect.

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

Error
Location
scripts/openclaw_memory_fusion.py:1654
Finding

Untrusted Rollback Manifest Enables Arbitrary File Deletion and Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/openclaw_memory_fusion.py, lines 1654–1683 and 2212–2222
Vulnerability Type: Unvalidated file paths from an untrusted rollback manifest
Risk Level: High

Vulnerable Code

python
def rollback_manifest(manifest_path: Path, dry_run: bool = False) -> Dict[str, Any]:
    manifest = read_json(manifest_path)
    if manifest.get("status") == "rolled_back":
        return {"rolled_back": False, "reason": "manifest already rolled back", "manifest_path": str(manifest_path)}

    deleted: List[str] = []
    restored: List[str] = []

    for path_str in reversed(manifest.get("created_files", [])):
        path = Path(path_str)
        if path.exists():
            if not dry_run:
                path.unlink()
            deleted.append(str(path))

    for item in manifest.get("backups", []):
        original = Path(item["path"])
        backup = Path(item["backup"])
        if backup.exists():
            if not dry_run:
                original.parent.mkdir(parents=True, exist_ok=True)
                shutil.copy2(backup, original)
            restored.append(str(original))

    if not dry_run:
        manifest["status"] = "rolled_back"
        manifest["rolled_back_at"] = datetime.now().isoformat(timespec="seconds")
        manifest_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")

The caller allows an arbitrary manifest path:

python
def cmd_rollback(args: argparse.Namespace) -> int:
    layout = Layout(resolve_workspace(args.workspace), resolve_config_path(args.config))
    layout.ensure_dirs()
    manifest_path = None
    if args.manifest:
        manifest_path = Path(args.manifest).expanduser()
    elif args.latest:
        manifest_path = latest_manifest_path(layout)
    if not manifest_path:
        raise SystemExit("No manifest found for rollback.")
    payload = rollback_manifest(manifest_path, dry_run=args.dry_run)
    print(json.dumps(payload, 
...[truncated 2566 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict explicit manifests to the trusted manifest directory:

    python
    manifest_root = layout.manifests_dir.resolve()
    manifest_path = manifest_path.resolve(strict=True)
    if not manifest_path.is_relative_to(manifest_root):
        raise SystemExit("Manifest must be inside the workspace manifest directory.")
    
  2. Validate the manifest against a strict schema. Reject missing, unexpected, or incorrectly typed fields.

  3. Canonicalize every deletion and restoration destination and require it to be within the configured workspace or an explicit allowlist of files legitimately managed by the command.

  4. Require each backup source to be inside the checkpoint directory recorded for that manifest:

    python
    checkpoint_root = Path(manifest["checkpoint_root"]).resolve(strict=True)
    backup = Path(item["backup"]).resolve(strict=True)
    if not backup.is_relative_to(checkpoint_root):
        raise SystemExit("Backup path is outside the trusted checkpoint.")
    
  5. Reject symlink targets and verify file type before deletion or restoration. Use safe file-descriptor-based operations where practical to reduce time-of-check/time-of-use races.

  6. Cross-check each path against trusted mutation state rather than treating manifest content as authoritative. Consider signing manifests or storing an integrity hash in protected local state.

  7. Make rollback a dry run by default and require an explicit --apply option for mutations.

  8. Display the validated deletion and restoration list and require confirmation for interactive use.

  9. Add tests covering arbitrary absolute paths, .. traversal, symlink escapes, manipulated checkpoint paths, malformed manifests, and restoration destinations outside the workspace.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises and instructs use of local Python scripts that read and write workspace files, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. That mismatch weakens least-privilege controls and can cause an agent or reviewer to underestimate the skill's filesystem and environment access, increasing the risk of unintended or overly broad execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file hard-codes numerous Chinese keywords and phrases for core behavior such as section classification, correction detection, status extraction, and importance heuristics. There is no visible mechanism for users to choose language/locale or documentation in this file justifying that the tool is intentionally China/Chinese-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The install path can persist remote embedding credentials directly into the OpenClaw config file when the provider is set to OpenAI or Gemini. Storing API keys in a broadly readable local config increases the chance of credential disclosure through backups, source control, logs, or other local tooling, especially because the CLI does not present a strong warning or require explicit confirmation for secret persistence.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The configuration helper can enable session memory persistence across conversations, causing natural-language content to be retained and reused beyond the immediate session. In a memory-fusion skill that already aggregates project and event data, this expands the amount of potentially sensitive user content stored and increases exposure if the local memory store is accessed, synced, or queried unexpectedly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The rollback path removes files listed in the manifest via path.unlink() and can also overwrite originals from backups, which is a destructive filesystem operation. The code exposes --dry-run, but the actual apply path has no explicit confirmation prompt or warning output immediately before deletion/restoration.

Content

No source excerpt is available for this finding.