Back to skill

Security audit

Huo15 Token Optimizer

Security checks for vulnerabilities and agentic risk

Overview

This token cleanup skill is not obviously malicious, but it needs review because its scripts can modify persistent OpenClaw workspace memory and instruction files with imperfect safeguards.

Install only if you are comfortable with a Chinese-language tool that reads OpenClaw workspace memory/instruction files and, after confirmation, modifies DREAMS.md and restores backup files. Review dry-run output carefully, avoid using custom --workspace or --restore paths, keep auto_replace_agents false, and make an independent backup before forced cleanup or restore.

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

Error
Location
scripts/clean.py:84
Finding

Unvalidated cleanup and restore paths permit unintended file modification

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/clean.py:27
Finding

DREAMS.md reconstruction can silently discard unrelated content

Content
View full analysis
)(.*?)()', content, re.DOTALL) deep_match = re.search(r'(## Deep Sleep.*)', content, re.DOTALL) if not diary_match: return None, None header = content[:diary_match.start(1)] start_tag = diary_match.group(1) diary_body = diary_match.group(2) end_tag = diary_match.group(3) entries = re.split(r'\n\*[A-Z]', diary_body) if len(entries) <= keep_entries + 1: return None, None kept = entries[0] for entry in entries[-keep_entries:]: kept += '\n*' + entry[1:] if entry.startswith(' ') else '\n*' + entry new_content = header + start_tag + kept.strip() + '\n\n' + end_tag if deep_match: new_content += '\n\n' + deep_match.group(1) return new_content, len(entries) - keep_entries - 1 ``` ### Technical Analysis The function does not modify only the matched diary body. Instead, it reconstructs the entire file from: 1. Content before the diary start marker. 2. The start marker. 3. Retained diary entries. 4. The end marker. 5. The first suffix beginning with `## Deep Sleep`, if one exists. All content after the diary end marker and before `## Deep Sleep` is omitted. If no `## Deep Sleep` heading exists, all content following the diary end marker is discarded. This behavior can remove unrelated notes, metadata, or custom sections even though the advertised operation is limited to truncating old dream entries. The entry parser is also format-sensitive because it splits only on newline entries matching `*[A-Z]`. Unexpected formatting can cause incorrect entry boundaries and reconstruction. ...[truncated 1087 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/clean.py:14
Finding

Date-only backup naming permits recovery copies to be overwritten

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (12)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill metadata says AGENTS files are 'never auto-replaced', but this code will automatically replace a workspace AGENTS.md when it matches a pattern and the config flag auto_replace_agents is enabled. That creates a trust-boundary violation: operational behavior is less safe than advertised, and important agent instructions or security constraints in workspace-specific AGENTS.md files could be silently overwritten.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill describes and encourages execution of local scripts that can modify and restore workspace files, but it does not declare an explicit tool scope such as allowed-tools or permissions. That mismatch weakens security review and policy enforcement because an agent may be induced to use file read/write capabilities beyond what the manifest transparently communicates.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

Allowing the AI to proactively suggest activation when it merely detects that the session context is 'too large' introduces an ambiguous trigger that can cause the skill to engage without a clear user request. In this skill's context, that increases the chance of unnecessary scanning or nudging the user toward cleanup actions on sensitive workspace files, even though later steps include confirmation gates.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file contains user-facing instructions only in Chinese, and there is no indication that the skill or guide is intentionally limited to Chinese-speaking users. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file is written entirely in Chinese and presents the guidance as the default without any opt-in, alternative language, or explanation that the content is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring is written as a Chinese-only description, indicating a language-specific skill presentation. Under the policy, forcing a specific language without user opt-in or a documented region-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The comment suggests AGENTS slimming should not affect custom files, but matching files are still auto-replaced if they appear to use the 'old verbose format'. Relying on a brittle regex heuristic to distinguish safe-to-replace files can misclassify real workspace policy documents, leading to unintended loss or weakening of agent instructions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script prints operational messages such as dry-run status, execution results, backup errors, and restore notices only in Chinese. Because these are user-facing strings and no language choice or locale justification is provided, this violates the language/locale policy criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file uses Chinese-only natural-language strings in the module docstring and all user-facing report output, with no indication that language is configurable or limited to a China-specific use case. This can violate language/locale policy when users are not given an opt-in or alternative locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring mixes English with Chinese and presents the skill as a Chinese-localized scanner description without any indication that language choice is optional. This can violate language/locale policy when a skill imposes a specific language presentation on users without offering opt-in or alternatives.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring is written only in Chinese, and the script's user-facing output is likewise Chinese-only, indicating a fixed language choice. For a general-purpose monitoring utility, this is a natural-language policy issue because it imposes a locale without user opt-in or any documented regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

These print statements provide the operational interface of the script, but they are hard-coded to Chinese and do not offer an alternative language or user selection. That creates a language-policy violation under the stated rule because the skill forces a specific language for interaction.

Content

No source excerpt is available for this finding.