Back to skill

Security audit

Memory Maintenance

Security checks for vulnerabilities and agentic risk

Overview

This memory-maintenance skill is coherent in purpose, but it needs Review because it sends broad memory/profile content to Gemini and can move or delete files with weak safeguards.

Install only if you are comfortable with your OpenClaw memory notes, MEMORY.md, and USER.md being sent to Gemini. Review or patch the scripts first to avoid sourcing .env files, add redaction or opt-in before remote analysis, validate all model-generated file paths, and disable or inspect the daily cron cleanup before allowing automated file movement or deletion.

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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/apply.sh:120
Finding

LLM-Controlled Path Traversal in Maintenance Operations

Content
View full analysis
/dev/null || echo "") if [ -z "$SAFE_TASKS" ]; then echo " No safe tasks to apply." else echo "$SAFE_TASKS" | while IFS= read -r task; do TYPE=$(echo "$task" | jq -r '.type') TARGET=$(echo "$task" | jq -r '.target') ACTION=$(echo "$task" | jq -r '.action') echo " Processing: $TYPE $TARGET" case "$TYPE" in archive) # Move to archive directory if [ -f "$WORKSPACE/$TARGET" ]; then BASENAME=$(basename "$TARGET") mkdir -p "$WORKSPACE/memory/archive" mv "$WORKSPACE/$TARGET" "$WORKSPACE/memory/archive/$BASENAME" echo " ✓ Archived to memory/archive/$BASENAME" else echo " ✗ File not found: $TARGET" fi ;; ``` The unrestricted operations continue in all mode: ```bash jq -c '.maintenance_suggestions[]' "$REVIEW_FILE" | while IFS= read -r task; do TYPE=$(echo "$task" | jq -r '.type') TARGET=$(echo "$task" | jq -r '.target') ACTION=$(echo "$task" | jq -r '.action') echo " Processing: $TYPE $TARGET" case "$TYPE" in archive) if [ -f "$WORKSPACE/$TARGET" ]; then BASENAME=$(basename "$TARGET") mkdir -p "$WORKSPACE/memory/archive" mv "$WORKSPACE/$TARGET" "$WORKSPACE/memory/archive/$BASENAME" echo " ✓ Archived" else echo " ✗ Not found" fi ;; rename) # Parse "old -> new" from action OLD= ...[truncated 2526 chars]
Remediation
View remediation

other

Warning
Location
scripts/review.sh:31
Finding

External Disclosure of Complete Memory and User Profile Content

Content
View full analysis
/dev/null || date -d "${i} days ago" +%Y-%m-%d 2>/dev/null) NOTE_FILE="$WORKSPACE/memory/${DAY}.md" if [ -f "$NOTE_FILE" ]; then DAILY_NOTES="${DAILY_NOTES} === ${DAY}.md === $(cat "$NOTE_FILE")" fi done ``` ```bash MEMORY_MD=$(cat "$WORKSPACE/MEMORY.md" 2>/dev/null || echo "") USER_MD=$(cat "$WORKSPACE/USER.md" 2>/dev/null || echo "") ``` ```bash echo "$DAILY_NOTES" >> "$OUTPUT_DIR/.prompt.tmp" cat >> "$OUTPUT_DIR/.prompt.tmp" << 'PROMPTEOF' ## Current MEMORY.md: PROMPTEOF echo "$MEMORY_MD" >> "$OUTPUT_DIR/.prompt.tmp" cat >> "$OUTPUT_DIR/.prompt.tmp" << 'PROMPTEOF' ## Current USER.md: PROMPTEOF echo "$USER_MD" >> "$OUTPUT_DIR/.prompt.tmp" ``` ```bash echo "[$TIMESTAMP] Running Gemini analysis..." RESULT_FILE=$(mktemp) if ! gemini --model gemini-2.5-flash "$PROMPT" > "$RESULT_FILE" 2>&1; then echo "[$TIMESTAMP] ERROR: Gemini failed" cat "$RESULT_FILE" rm -f "$RESULT_FILE" exit 1 fi ``` ### Technical Analysis The script reads complete daily notes, `MEMORY.md`, and `USER.md`, embeds their contents in a prompt, and submits that prompt through the Gemini CLI. These files can contain personal history, preferences, contacts, infrastructure information, credentials accidentally recorded in notes, confidential project details, or other sensitive information. The implementation performs no secret scanning, redaction, field-level minimization, sensitivity classification, or explicit confirmation immediately before transmission. Although project documentation states that Gemini is used, it does not provide technical controls limiting which memory content is tr ...[truncated 975 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/install.sh:27
Finding

Arbitrary Shell Execution Through Sourced Environment Files

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/review.sh:101
Finding

Indirect Prompt Injection Can Influence Filesystem Maintenance Decisions

Content
View full analysis
> "$OUTPUT_DIR/.prompt.tmp" cat >> "$OUTPUT_DIR/.prompt.tmp" << 'PROMPTEOF' ## Current MEMORY.md: PROMPTEOF echo "$MEMORY_MD" >> "$OUTPUT_DIR/.prompt.tmp" cat >> "$OUTPUT_DIR/.prompt.tmp" << 'PROMPTEOF' ## Current USER.md: PROMPTEOF echo "$USER_MD" >> "$OUTPUT_DIR/.prompt.tmp" ``` The prompt asks the model to produce actionable maintenance operations: ```bash "maintenance_suggestions": [ { "type": "archive|rename|delete|consolidate", "target": "filepath", "action": "specific action to take", "reason": "why this needs attention", "safe_to_auto": boolean, "backup_required": boolean } ], ``` The resulting prompt is then submitted to Gemini: ```bash PROMPT=$(cat "$OUTPUT_DIR/.prompt.tmp") rm -f "$OUTPUT_DIR/.prompt.tmp" echo "[$TIMESTAMP] Running Gemini analysis..." RESULT_FILE=$(mktemp) if ! gemini --model gemini-2.5-flash "$PROMPT" > "$RESULT_FILE" 2>&1; then echo "[$TIMESTAMP] ERROR: Gemini failed" cat "$RESULT_FILE" rm -f "$RESULT_FILE" exit 1 fi ``` ### Technical Analysis Daily notes and memory files are untrusted document content, but they are concatenated into the same textual context as operational instructions. The prompt does not establish a strong trust boundary or direct the model to treat instructions found in reviewed documents exclusively as inert data. The model output includes file paths, operation types, and a `safe_to_auto` decision. Those values are later consumed by `apply.sh`. JSON syntax validation with `jq` verifies only that the output is parseable; it does not establish that the recommendations are safe, aut ...[truncated 1221 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cleanup.sh:58
Finding

Configured Deletion Safety Controls Are Ignored by Cleanup

Content
View full analysis
/dev/null | while read -r file; do mv "$file" "$MEMORY_DIR/.trash/" DELETED_COUNT=$((DELETED_COUNT + 1)) echo " Moved to trash: $(basename "$file")" done ``` Files in `.consolidated` are permanently removed: ```bash if [ -d "$WORKSPACE/memory/.consolidated" ]; then CONSOLIDATED_AGE=$(find "$WORKSPACE/memory/.consolidated" -type f -mtime +7 2>/dev/null | wc -l | tr -d ' ') if [ "$CONSOLIDATED_AGE" -gt 0 ]; then echo "[$TIMESTAMP] Cleaning up old consolidated fragments..." find "$WORKSPACE/memory/.consolidated" -type f -mtime +7 -exec rm {} \; rmdir "$WORKSPACE/memory/.consolidated" 2>/dev/null || true fi fi ``` The project configuration declares controls that the script never reads: ```json "maintenance": { "archive_after_days": 7, "retention_days": 30, "consolidate_fragments": true, "auto_archive_safe": true }, "safety": { "require_approval_for_content": true, "require_approval_for_delete": true, "trash_instead_of_delete": true } ``` ### Technical Analysis `cleanup.sh` does not load `config/settings.json`. It consequently ignores the configured retention values and the requirements that deletion receive approval and use trash instead of permanent removal. While archived review files are moved to trash, old files under `memory/.consolidated` are deleted directly with `rm`. No confirmation, backup, or recovery mechanism is provided. This contradicts the documented safety model. ### Attack Path 1. Memory fragments are placed in `$WORKSPACE/memory/.consolidated`. 2. Their modification time becomes more than seven ...[truncated 559 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill explicitly requires GEMINI_API_KEY, gemini, and processes daily notes and memory content for LLM-based analysis, which implies external transmission of potentially sensitive workspace data. If this outbound data flow and environment loading are not clearly declared as permissions/capabilities, users may unknowingly allow confidential notes, operational history, or secrets embedded in memory files to be sent to a third-party service.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The skill explicitly requires GEMINI_API_KEY, gemini, and processes daily notes and memory content for LLM-based analysis, which implies external transmission of potentially sensitive workspace data. If this outbound data flow and environment loading are not clearly declared as permissions/capabilities, users may unknowingly allow confidential notes, operational history, or secrets embedded in memory files to be sent to a third-party service.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The skill explicitly requires GEMINI_API_KEY, gemini, and processes daily notes and memory content for LLM-based analysis, which implies external transmission of potentially sensitive workspace data. If this outbound data flow and environment loading are not clearly declared as permissions/capabilities, users may unknowingly allow confidential notes, operational history, or secrets embedded in memory files to be sent to a third-party service.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The script sources $WORKSPACE/.env directly in the current shell during installation. Because shell source executes arbitrary shell code rather than safely parsing key/value pairs, a malicious or tampered .env file can run commands with the installer's privileges, leading to code execution and possible credential or workspace compromise.

Content

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

sh
# Check Gemini auth
if [ -z "$GEMINI_API_KEY" ]; then
    if [ -f "$WORKSPACE/.env" ]; then
        set -a
        source "$WORKSPACE/.env"
        set +a

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The use of set -a around sourcing the .env file exports every variable defined by that file into the environment. Combined with source, this amplifies the risk from a malicious .env by both executing arbitrary commands and propagating attacker-controlled environment values to later commands in the installer.

Content

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

sh
if [ -z "$GEMINI_API_KEY" ]; then
    if [ -f "$WORKSPACE/.env" ]; then
        set -a
        source "$WORKSPACE/.env"
        set +a
    fi
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

sh
fi

if [ -z "$GEMINI_API_KEY" ]; then
    echo "⚠️  GEMINI_API_KEY not set. Add to $WORKSPACE/.env"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

Accessing the workspace .env for a memory review task creates unnecessary credential exposure. Even if the script does not intentionally print the values, loading them into the process environment broadens the blast radius to logs, subprocesses, crash output, and external tool integrations.

Content

Scanner excerpt · scripts/review.sh (reported line 10)May include surrounding context.

sh
set -e

# Load environment
if [ -f "/Users/maxhutchinson/.openclaw/workspace/.env" ]; then
    set -a
    source /Users/maxhutchinson/.openclaw/workspace/.env
    set +a

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The use of 'set +a' implies variables were exported after sourcing .env, meaning secrets may have been inherited by subsequent child processes such as Gemini. Exporting credentials to unrelated subprocesses significantly increases accidental leakage risk.

Content

Scanner excerpt · scripts/review.sh (reported line 12)May include surrounding context.

sh
# Load environment
if [ -f "/Users/maxhutchinson/.openclaw/workspace/.env" ]; then
    set -a
    source /Users/maxhutchinson/.openclaw/workspace/.env
    set +a
fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/review.sh (reported line 201)May include surrounding context.

sh
PROMPTEOF

PROMPT=$(cat "$OUTPUT_DIR/.prompt.tmp")
rm -f "$OUTPUT_DIR/.prompt.tmp"

# ============================================
# RUN GEMINI ANALYSIS

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The script explicitly selects and invokes an external model provider for analysis of workspace memory content. In this skill context, that external dependency is dangerous because it transmits sensitive local data outside the workspace boundary and may violate user expectations or policy constraints.

Content

Scanner excerpt · scripts/review.sh (reported line 210)May include surrounding context.

sh
echo "[$TIMESTAMP] Running Gemini analysis..."
RESULT_FILE=$(mktemp)

if ! gemini --model gemini-2.5-flash "$PROMPT" > "$RESULT_FILE" 2>&1; then
    echo "[$TIMESTAMP] ERROR: Gemini failed"
    cat "$RESULT_FILE"
    rm -f "$RESULT_FILE"

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script concatenates recent daily notes, MEMORY.md, USER.md, and directory metadata into a prompt and sends it to the external Gemini CLI. That creates a clear data exfiltration path for sensitive workspace memory that is inconsistent with a local maintenance skill and expands exposure beyond what is necessary for the task.

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 automatic cleanup, archiving, and retention behavior, but it does not clearly warn users that files may be moved or removed as part of routine operation. In a memory-maintenance skill, this omission is meaningful because users may execute the provided scripts expecting low-risk maintenance, while data-impacting behavior could alter or hide important notes, reviews, or historical context.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises installation and execution of shell-based components (install.sh, Gemini CLI, jq, cron-style automation) but does not declare any explicit tool scope or permissions. This creates a transparency and control gap: users and hosting platforms cannot accurately constrain what the skill is allowed to execute, increasing the risk of overbroad filesystem access or command execution during install and runtime.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The warning and mode description state that all suggestions, including MEMORY.md updates, will be applied. However, the content-suggestion block only prints that MEMORY.md application is a future feature and requires manual or separate agent action, so the documentation in this script contradicts its real behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script primarily operates under $WORKSPACE/agents/memory but also deletes files under a separate path, $WORKSPACE/memory/.consolidated. Modifying a second memory tree outside the declared primary directory increases blast radius and can affect unrelated agent state or user data, making the behavior harder to audit and more surprising in an automated maintenance skill.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script performs irreversible deletion with rm inside the .consolidated tree, while the skill description emphasizes cleanup, archival, and trash-based retention elsewhere. This is dangerous because a maintenance skill may unexpectedly destroy data that users assume will be archived or recoverable, especially when run automatically on a schedule.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The command find ... -exec rm {} \; deletes files without confirmation, dry-run support, or a user-visible warning, despite the rest of the script often using archival or trash semantics. In a daily automated job, this can silently erase potentially important memory fragments, and any path/configuration mistake would immediately become destructive.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest describes local memory management tasks such as reviewing notes, suggesting MEMORY.md updates, maintaining directory health, and cleaning old files. While AI-assisted review is plausible, this installer explicitly depends on an external Gemini CLI and API key, introducing credential handling and implied external model access that is not stated in the manifest description of the skill itself.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The comment at L005 asserts the review only outputs suggestions and never auto-applies them. However, the generated report and alert at L342-L351 and L373-L376 direct use of an apply script for --safe and --all modes, framing this review as part of an automation pipeline for applying changes.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script sources the entire workspace .env into its environment before performing review operations, even though the review logic does not require all secrets. This unnecessarily exposes credentials to the shell process and any child processes, including the external Gemini invocation, increasing the chance of accidental leakage or misuse.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt is designed to ingest broad daily notes and memory files, summarize them, and persist the results into review artifacts with no filtering, redaction, or scope reduction. This can propagate sensitive personal or operational information into additional files and external systems, increasing both exposure and retention.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Sensitive memory, user notes, and workspace context are sent to an external model without any explicit warning, consent flow, or privacy notice in the script. Users may reasonably expect local maintenance, so the absence of disclosure materially increases privacy risk and prevents informed consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The example configuration hard-codes "timezone": "Europe/London", which imposes a locale-specific default in the skill documentation. The file does not indicate that the timezone is merely illustrative or prompt the user to choose their own locale, so it can conflict with organizational language/locale choice policies.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The header describes this as an apply script for review suggestions, which implies both categories in the review file are actionable here. In reality, only maintenance tasks are executed; content suggestions are always left for manual follow-up, creating an intent/documentation mismatch.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This shell script writes a default settings file that hard-codes the locale-specific value "Europe/London". Under the policy, forcing a specific locale without offering user choice or documenting a justified regional constraint is a natural-language policy issue.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.