Back to skill

Security audit

Agent Memory System

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent memory-management purpose, but it installs recurring cron jobs and contains an unsafe extraction script that can affect files outside the intended workspace if misused.

Review before installing. Use manual setup unless you intentionally want background memory jobs, inspect the exact cron entries, and know how to remove them. Avoid passing path-like values such as ../ or absolute paths to extract-skill.sh until the script validates names and confines writes to the OpenClaw workspace.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (2)

T06 · System Persistence

Error
Location
install.sh:202
Finding

Installers Establish Persistent Scheduled Execution Through User Crontab

Content
View full analysis
/dev/null | grep -q "agent-memory-system"; then log_info "cron tasks already exist; skipping" else ( crontab -l 2>/dev/null || true echo "# agent-memory-system" echo "0 0 * * 0 $GC_SCRIPT >> $LOG_DIR/memory-gc.log 2>&1" echo "# agent-memory-system" echo "45 23 * * * $REFLECTION_SCRIPT >> $LOG_DIR/nightly-reflection.log 2>&1" ) | crontab - fi ``` The security-relevant commands in `scripts/install.sh:50-62` are: ```bash if crontab -l 2>/dev/null | grep -q "memory-gc.sh"; then echo "Existing memory-gc.sh configuration detected; skipping" else (crontab -l 2>/dev/null | grep -v "memory-gc.sh" || true; echo "0 0 * * 0 $SCRIPT_DIR/memory-gc.sh") | crontab - fi if crontab -l 2>/dev/null | grep -q "nightly-reflection.sh"; then echo "Existing nightly-reflection.sh configuration detected; skipping" else (crontab -l 2>/dev/null | grep -v "nightly-reflection.sh" || true; echo "45 23 * * * $SCRIPT_DIR/nightly-reflection.sh") | crontab - fi ``` ### Technical Analysis Both installers modify the current user's crontab and establish recurring execution of scripts stored in the Skill directory. The weekly task runs `memory-gc.sh`, while the daily task runs `nightly-reflection.sh`. The scheduled behavior supports the advertised automatic archival and nightly-reflection features and is documented in `README.md` and `SKILL.md`. It is therefore not covert or unrelated to the declared functionality. Nevertheless, it creates execution persistence that survives the installer and future agent sessions. The top-level `install.sh` performs the modification automatically, without explicit confirmation. The secondary installer asks for consent, but defaults t ...[truncated 1608 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/extract-skill.sh:15
Finding

Path Traversal Allows Writes, Source Modification, and Recursive Deletion Outside Intended Directories

Content
View full analysis
Remediation
View remediation
&2 exit 1 } validate_slug "$SKILL_NAME" || { printf '%s\n' "Invalid skill name" >&2 exit 1 } ``` 2. Explicitly reject `/`, backslashes, `..`, control characters, newlines, and leading hyphens. 3. Canonicalize the base and destination paths with `realpath` or an equivalent mechanism. 4. Verify containment before every read, write, modification, or deletion: ```bash skills_base="$(realpath -m -- "$SKILLS_DIR")" skill_target="$(realpath -m -- "$SKILL_DIR")" case "$skill_target" in "$skills_base"/*) ;; *) printf '%s\n' "Destination escapes the skills directory" >&2 exit 1 ;; esac ``` 5. Perform the same canonical containment check for `LESSON_FILE` beneath `$LESSONS_DIR`. 6. Never run `rm -rf` until containment, ownership, and destination type have been verified. 7. Reject symbolic-link destinations or use file-system operations that do not follow symlinks unexpectedly. 8. Replace destructive overwrite behavior with a safer backup or fail-closed policy. 9. Add automated tests covering `../`, absolute paths, repeated separators, symlinks, newlines, empty names, and names beginning with `-`. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • 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 (32)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description promises broad long-term memory and skill extraction capabilities, but the visible documented behavior primarily concerns local file management, archival, and generation of new skill directories/files. Overstating capabilities while omitting concrete resource interactions can mislead operators into granting trust to a component that performs broader filesystem changes than the description suggests.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The description promises broad long-term memory and skill extraction capabilities, but the visible documented behavior primarily concerns local file management, archival, and generation of new skill directories/files. Overstating capabilities while omitting concrete resource interactions can mislead operators into granting trust to a component that performs broader filesystem changes than the description suggests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README advertises unattended weekly GC and nightly reflection jobs but does not clearly warn that these tasks will run automatically and may modify, validate, or archive user memory data over time. In a persistence-focused memory skill, background tasks materially change data lifecycle and should be explicitly disclosed so users can make an informed installation decision.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The one-click install path instructs users to execute an install script described as 'automatic configuration' without clearly foregrounding that it may create directories and configure scheduled tasks. Running setup scripts with side effects is risky because users may grant persistence or filesystem changes they did not expect, especially in an agent environment.

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 36)May include surrounding context.

md
clawhub install agent-memory-system

# 手动创建目录
mkdir -p ~/.openclaw/workspace/memory/{lessons,decisions,people,reflections,.archive}

# 手动配置 cron
crontab -e

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The README instructs users to add cron entries that will execute scripts on a recurring basis, creating persistence outside the immediate user session. Persistence is especially sensitive in an agent memory skill because the jobs will continue processing historical data automatically and could keep running after the user forgets they were installed.

Content

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

md
mkdir -p ~/.openclaw/workspace/memory/{lessons,decisions,people,reflections,.archive}

# 手动配置 cron
crontab -e
# 添加:
# 0 0 * * 0 ~/.openclaw/workspace/skills/agent-memory-system/scripts/memory-gc.sh
# 45 23 * * * ~/.openclaw/workspace/skills/agent-memory-system/scripts/nightly-reflection.sh

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The markdown describes automatic archival, file movement, and file generation as routine features without prominent warnings about destructive or state-changing side effects. In a memory system, silent movement of files into archives can affect availability, troubleshooting, retention expectations, and downstream tools that rely on stable paths.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

The initialization steps create durable workspace directories and files that establish ongoing state for the agent, which qualifies as persistence-related behavior in practice. In context this is expected for a memory system, but it still alters the user's environment and can create long-lived data stores without any warning about retention, privacy, or cleanup.

Content

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

2. 初始化目录

bash
mkdir -p ~/.openclaw/workspace/memory/{lessons,decisions,people,reflections,.archive}
touch ~/.openclaw/workspace/memory/INDEX.md
touch ~/.openclaw/workspace/MEMORY.md

Session Persistence

Medium
Category
Rogue Agent
Confidence
95% confidence
Finding

The skill instructs the user to add persistent cron jobs that will continue executing scripts outside the immediate session. Persistence mechanisms are security-sensitive because they create recurring execution paths that can later run modified scripts, affect user data continuously, and be overlooked after installation.

Content

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

bash
# 编辑 crontab
crontab -e

# 添加以下内容
0 0 * * 0 ~/.openclaw/workspace/skills/agent-memory-system/scripts/memory-gc.sh >> ~/.openclaw/logs/memory-gc.log 2>&1

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

假设有一个教训文件: memory/lessons/deploy-without-test.md

./scripts/extract-skill.sh deploy-without-test

会生成: skills/deploy-without-test/SKILL.md

然后手动完善 SKILL.md 内容

text

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

This code enumerates and rewrites the user's crontab during uninstall, which is persistence-related behavior. Although intended to remove prior entries, any installer that manipulates scheduled tasks affects session persistence and deserves scrutiny because mistakes in filtering or matching can alter unrelated cron configuration.

Content

Scanner excerpt · install.sh (reported line 52)May include surrounding context.

sh
# 移除 cron 任务
    log_info "移除 cron 任务..."
    (
        crontab -l 2>/dev/null | grep -v "agent-memory-system" || true
    ) | crontab - 2>/dev/null || log_warn "无法修改 crontab"
    
    # 询问是否删除数据

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

Piping modified content into crontab rewrites the user's scheduled tasks, which is a persistence mechanism and a sensitive operation. In this script it is used for cleanup, but a faulty grep-based transformation could remove or corrupt unrelated jobs, impacting availability or enabling stealthy persistence patterns in similar code.

Content

Scanner excerpt · install.sh (reported line 53)May include surrounding context.

sh
log_info "移除 cron 任务..."
    (
        crontab -l 2>/dev/null | grep -v "agent-memory-system" || true
    ) | crontab - 2>/dev/null || log_warn "无法修改 crontab"
    
    # 询问是否删除数据
    if [ -d "$MEMORY_DIR" ]; then

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% 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 · install.sh (reported line 98)May include surrounding context.

sh
fi
    
    # cron
    if command -v crontab &> /dev/null; then
        log_info "✓ crontab: 可用"
    else
        log_warn "✗ crontab 未安装(cron 任务将跳过)"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The installer adds persistent cron jobs to the user's crontab without an explicit opt-in or confirmation immediately before making the change. Even if the jobs are legitimate, silently establishing scheduled execution creates persistence and can surprise users, and in an agent skill context it increases risk because referenced scripts will run later outside the original install session.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Reading the current crontab to determine whether managed entries already exist is part of a persistence workflow. In isolation it is not harmful, but in the context of this installer it supports automatic creation of recurring jobs that execute later, making the overall behavior materially security-relevant.

Content

Scanner excerpt · install.sh (reported line 205)May include surrounding context.

sh
mkdir -p "$LOG_DIR"
    
    # 检查 cron 任务是否已存在
    if crontab -l 2>/dev/null | grep -q "agent-memory-system"; then
        log_info "cron 任务已存在,跳过"
    else
        # 添加 cron 任务

Session Persistence

Medium
Category
Rogue Agent
Confidence
98% confidence
Finding

This block appends new cron entries that will run local scripts on a recurring basis, which is classic persistence behavior. In an agent skill, that is more dangerous because future script changes or path hijacking could cause unreviewed code to execute automatically long after installation.

Content

Scanner excerpt · install.sh (reported line 210)May include surrounding context.

sh
else
        # 添加 cron 任务
        (
            crontab -l 2>/dev/null || true
            echo "# agent-memory-system - 每周日凌晨执行 GC"
            echo "0 0 * * 0 $GC_SCRIPT >> $LOG_DIR/memory-gc.log 2>&1"
            echo "# agent-memory-system - 每晚反思"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% 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 · install.sh (reported line 257)May include surrounding context.

sh
fi
    
    # 检查 cron
    if crontab -l 2>/dev/null | grep -q "agent-memory-system"; then
        log_info "✓ cron 任务已配置"
        ((CHECKS_PASSED++))
    fi

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This shell script contains natural-language comments, usage text, prompts, and status messages exclusively in Chinese, starting with the file description and examples. The policy requires flagging language or locale constraints when a skill forces a specific language without offering the user a choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script presents the created skill as requiring manual follow-up, but later also performs automatic mutation of the source lesson metadata. This mismatch can cause operators to underestimate side effects and approve a workflow that changes source records, which is risky in a long-term memory system where lesson provenance and status drive later automation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script does more than extraction: it edits the original lesson file in place using sed, changing status and adding skill-path metadata. In an agent memory context, silent source mutation can corrupt provenance, trigger downstream automation based on changed status, or overwrite manually curated metadata, especially since the path value is inserted without robust escaping.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This shell script presents its title, usage notes, prompts, and status messages in Chinese only, including the interactive prompt at L18. That creates a language/locale policy issue because users are not given an opt-in choice or an explanation that the skill is intended only for Chinese-speaking environments.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The script offers to install persistent cron jobs that will continue executing after installation, creating a form of persistence on the host. In the context of an agent skill, persistence is security-relevant because it schedules ongoing execution of local scripts that could later be modified or behave unexpectedly, even though the user is prompted before enabling it.

Content

Scanner excerpt · scripts/install.sh (reported line 50)May include surrounding context.

sh
if [[ "$CONFIG_CRON" == "y" || "$CONFIG_CRON" == "Y" ]]; then
    # 检查 crontab 是否已存在相关配置
    if crontab -l 2>/dev/null | grep -q "memory-gc.sh"; then
        echo "⚠️  检测到已有 memory-gc.sh 配置,跳过"
    else
        # 添加 GC 任务(每周日 00:00)

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

This line actively writes a new cron entry that executes memory-gc.sh weekly, establishing host persistence. While not inherently malicious, persistent execution increases risk because any compromise, tampering, or unsafe behavior in the referenced script will recur automatically without further user review.

Content

Scanner excerpt · scripts/install.sh (reported line 54)May include surrounding context.

sh
echo "⚠️  检测到已有 memory-gc.sh 配置,跳过"
    else
        # 添加 GC 任务(每周日 00:00)
        (crontab -l 2>/dev/null | grep -v "memory-gc.sh" || true; echo "0 0 * * 0 $SCRIPT_DIR/memory-gc.sh") | crontab -
        echo "✅ 已添加每周 GC 任务"
    fi

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The presence check itself is part of a persistence workflow for a recurring scheduled task. In security review of agent skills, logic that inspects and manages cron state is relevant because it facilitates durable background execution beyond the immediate install session.

Content

Scanner excerpt · scripts/install.sh (reported line 58)May include surrounding context.

sh
echo "✅ 已添加每周 GC 任务"
    fi
    
    if crontab -l 2>/dev/null | grep -q "nightly-reflection.sh"; then
        echo "⚠️  检测到已有 nightly-reflection.sh 配置,跳过"
    else
        # 添加反思任务(每天 23:45)

Session Persistence

Medium
Category
Rogue Agent
Confidence
95% confidence
Finding

This line installs a daily cron job for nightly-reflection.sh, creating another persistent execution path. Skill context makes this somewhat more dangerous because the package is specifically designed for long-term memory automation, so unattended recurring tasks are central to its behavior and can affect user data over time if the script is unsafe or later changed.

Content

Scanner excerpt · scripts/install.sh (reported line 62)May include surrounding context.

sh
echo "⚠️  检测到已有 nightly-reflection.sh 配置,跳过"
    else
        # 添加反思任务(每天 23:45)
        (crontab -l 2>/dev/null | grep -v "nightly-reflection.sh" || true; echo "45 23 * * * $SCRIPT_DIR/nightly-reflection.sh") | crontab -
        echo "✅ 已添加每日反思任务"
    fi
else

Static analysis

No suspicious patterns detected.