Back to skill

Security audit

Context Optimizer

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly purpose-aligned, but it automatically rewrites and moves OpenClaw memory files with weak safeguards and a hard-coded user workspace path.

Review this before installing. It should only run against a workspace you explicitly choose, preferably after adding a dry-run or confirmation mode, unique/versioned backups, and configurable schedule, timezone, notification, and archive paths. Avoid enabling the cron job until those safeguards are in place.

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

T09 · Insecure Skill Coding Practices

Warning
Location
optimize.js:82
Finding

Deterministic Archive Filename Causes Silent Backup Overwrite

Content
View full analysis
详细日志: archive/${DATE_STR}-detail.md\n`; fs.writeFileSync(dailyFile, optimized); ``` ### Technical Analysis The archive filename is derived only from the current date. Consequently, every optimization performed on the same day writes to the same archive path. Node.js `fs.writeFileSync()` opens an existing file for truncation by default. The code does not check whether the archive already exists, use exclusive creation, generate a unique version, or preserve the previous archive. A repeated execution can therefore silently overwrite the only detailed backup. This behavior contradicts the backup-first guarantee documented in `SKILL.md`. The subsequent rewrite of the active daily-memory file makes the problem more significant: if the archive is overwritten with an already summarized or otherwise changed version, the original detailed content may no longer exist anywhere. ### Attack Path 1. A daily-memory file larger than 1 KB exists for the current date. 2. The optimizer runs and writes the detailed content to `memory/archive/YYYY-MM-DD-detail.md`. 3. The active daily-memory file is rewritten. 4. The active file is subsequently expanded above the optimization threshold again. 5. The optimizer runs a second time on the same date. 6. `fs.writeFileSync()` truncates and replaces the existing archive without warning. 7. The previously archived detailed memory is irreversibly lost unless an independent external backup exists. This issue can be triggered accidentally through repeated scheduled or manual execution. Any acto ...[truncated 593 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
optimize.js:15
Finding

Hard-Coded Absolute Workspace Path Can Modify an Unintended User Workspace

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill sends Feishu notifications containing context-usage metrics and archive paths to an external service without clearly warning users that internal operational metadata will leave the local environment. While the sample message does not show full memory contents, usage levels, file paths, and anomaly alerts may still reveal sensitive workflow patterns or internal structure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documented /context-archive-all command can trigger bulk archival of all historical context, which risks unintended data loss or operational disruption if invoked without an explicit warning, confirmation step, or scope preview. In this skill’s context, the command operates on conversation memory and session history, so accidental use could remove important working context even if files are archived rather than destroyed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script overwrites the current daily memory file with a reduced version after silently copying the original to an archive path. Even though a backup is created, this still modifies user-authored data without confirmation, dry-run support, or integrity checks, which creates risk of unintended data loss or destructive behavior if the archive write fails or the optimization logic is incorrect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script automatically moves historical session files into an archive directory based on filename/date heuristics and content markers, without user approval. This can unexpectedly relocate important user files, disrupt downstream workflows that depend on stable paths, and cause effective data loss from the user's perspective even if the files remain on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script silently archives older daily memory files solely from age/size/activity heuristics, changing the location of user-authored content without consent. In a memory-management skill, this behavior is especially sensitive because these files are likely relied upon for recall and agent context, so incorrect archival can degrade functionality or hide important records.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script replaces DREAMS.md with a generated summary after archiving the original, which is more dangerous than a simple move because it actively destroys the original working-state file and substitutes synthesized content. If the generated summary is incomplete, misleading, or the archive path is not later consulted, the user can lose meaningful information and automation depending on DREAMS.md may operate on altered data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The trigger condition fixes execution to 23:00 (Asia/Shanghai), and the configuration later hardcodes the same timezone. This is a locale-specific behavior presented as default operation without offering user choice or documenting why that locale is required.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The JSON configuration sets timezone to Asia/Shanghai, which imposes a specific locale on all scheduled behavior. The document does not indicate user selection, fallback behavior, or a region-specific justification for this constraint.

Content

No source excerpt is available for this finding.