Back to skill

Security audit

OpenClaw Memory Canonical

Security checks for vulnerabilities and agentic risk

Overview

This local memory skill is mostly coherent, but it needs review because its file-maintenance scripts can overwrite stored records in edge cases and its activation scope is broad.

Install only if you want this agent to maintain persistent local memory in this workspace. Review the broad activation triggers and consider patching the shell scripts to use secure temporary files and no-clobber archival before relying on it for important records. Avoid shared-writable memory directories.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/atomic-write.sh:8
Finding

Predictable Temporary File Allows Symlink-Based File Overwrite

Content
View full analysis
"$TMP" else shift printf '%s\n' "$*" > "$TMP" fi sync "$TMP" 2>/dev/null || sync mv "$TMP" "$FILE" ``` ### Technical Analysis The script derives its temporary path from the destination filename and process ID: ```bash TMP="${FILE}.tmp.$$" ``` Process IDs are observable or predictable on typical local systems. The temporary file is then opened using ordinary shell redirection without exclusive creation, a symbolic-link check, or a securely randomized filename. An attacker who can write to the destination directory can pre-create the predicted temporary path as a symbolic link. When `cat` or `printf` opens that path, the operating system follows the link and truncates the linked file using the invoking user's permissions. The final `mv` does not prevent the preceding redirected write. Even if the rename subsequently fails or replaces the symbolic link itself, the linked file may already have been overwritten. ### Attack Path 1. Identify a destination passed to `atomic-write.sh`, such as `memory/working-buffer.md`. 2. Observe or predict the process ID that will execute the script. 3. Create a symbolic link named `memory/working-buffer.md.tmp.` pointing to another file writable by the victim account. 4. Cause or wait for the victim to invoke `atomic-write.sh`. 5. The script follows the symbolic link when executing `cat > "$TMP"` or `printf ... > "$TMP"`. 6. The target of the symbolic link is truncated and replaced with the supplied memory content. Successful exploitation requires local write access to the destination directory and sufficient timing or process visibility to predict the temporary filename. ### Impact Assessment The vulnera ...[truncated 577 chars]
Remediation
View remediation
&2 exit 1 fi ``` 4. Write only to the file descriptor returned for the securely created temporary file. 5. Preserve intended ownership and mode where appropriate, then flush the file and parent directory before and after the atomic rename. 6. Rename using explicit option termination: ```bash mv -- "$TMP" "$FILE" trap - EXIT HUP INT TERM ``` 7. Add a regression test that pre-creates likely temporary filenames and symbolic links, confirming that no unrelated file can be modified. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/archive-old-episodic.sh:30
Finding

Episodic Archival Can Silently Overwrite Existing Archived History

Content
View full analysis
/dev/null)" ]; then fname=$(basename "$file") year="${fname:0:4}" month="${fname:5:2}" dest="$ARCHIVE_DIR/$year/$month" mkdir -p "$dest" echo " Archive: $fname → $year/$month/" mv "$file" "$dest/" count=$((count + 1)) fi done ``` ### Technical Analysis The archive destination is constructed from the source filename, after which the script moves the source into the destination directory without checking whether a file with the same basename already exists: ```bash mv "$file" "$dest/" ``` On common Unix implementations, `mv` replaces an existing destination file by default. Consequently, rerunning archival after recreating an episodic file with an already archived date can silently replace the prior archived record. This behavior conflicts with the Skill's stated archival and no-deletion goals because replacement of an existing archive is effectively destructive. The script also reports the operation as a successful archive without distinguishing a new archive from an overwrite. ### Attack Path 1. Ensure that an archived file already exists, for example: `memory/archive/2026/01/2026-01-10.md`. 2. Place or recreate an old source file with the same basename at: `memory/episodic/2026-01-10.md`. 3. Give the source an age exceeding the configured retention period. 4. Run `archive-old-episodic.sh`. 5. The script computes the existing archive directory and executes: `mv "$file" "$dest/"`. 6. The previous archived history is replaced by the newer source file without collision detection or preservation of the old version. An attacker must be ...[truncated 660 chars]
Remediation
View remediation
&2 exit 1 fi ``` 2. Use no-clobber move behavior where supported, and verify the result: ```bash mv -n -- "$file" "$dest_file" [ ! -e "$file" ] || { echo "ERROR: archival collision or move failure: $fname" >&2 exit 1 } ``` 3. For portability, avoid relying solely on `mv -n`. A safer design is to create a uniquely named destination or use an atomic operation that fails when the destination already exists. 4. If an existing file has the same content, compare cryptographic hashes and explicitly report it as an already archived duplicate. Do not delete either file automatically unless that behavior is deliberately approved. 5. If the contents differ, preserve both files using a deterministic suffix such as a timestamp or content hash. 6. Add tests for identical and differing destination collisions, symbolic-link destinations, and repeated archival runs. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/archive-old-learnings.sh:66
Finding

Learnings Archival Can Silently Overwrite Existing Archived Records

Content
View full analysis
/dev/null)" ]; then read -r year month <
Remediation
View remediation
&2 exit 1 fi ``` 2. Use a no-clobber or exclusive destination-creation strategy rather than ordinary `mv`. 3. Preserve conflicting versions under deterministic unique names, such as: ```text legacy-note...md ``` 4. Compare hashes when a collision occurs. Report identical content as already archived, and preserve both versions when contents differ. 5. Ensure archive destination directories are trusted, are not symbolic links, and have permissions that prevent untrusted users from planting collision targets. 6. Add regression tests covering repeated archive runs, duplicate filenames, differing content, pinned-file exclusions, and symbolic-link collision paths. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**If `health-check.sh` fails:**

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill advertises activation on very broad topics like memory systems, buffers, learnings, self-improvement, and how an AI should remember between sessions. That can cause the skill to trigger in many ordinary conversations, expanding its operational surface and increasing the chance that file-writing, script-copying, or shell-command guidance is applied when it was not specifically requested or appropriate.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.