Back to skill

Security audit

disk-cleaner

Security checks for vulnerabilities and agentic risk

Overview

This disk-cleaning skill is mostly purpose-aligned, but its deletion safeguards and defaults create a real risk of unintended data loss.

Review carefully before installing. This skill can be useful for freeing disk space, but only run it after inspecting the generated deletion list, avoid `--force`, use `--dry-run` first, prefer `--no-trash`, and do not use it as administrator/root. Be especially cautious around discovered items, Electron app storage, IDE local history, logs, and any cache directory that could be a symlink.

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

Error
Location
scripts/clean_cache.py:289
Finding

Resolved symlink targets are recursively deleted instead of unlinking the symlink

Content
View full analysis
str: try: real = os.path.realpath(os.path.abspath(path)) except Exception: real = os.path.abspath(path) real_norm = real.rstrip(os.sep).lower() if len(real_norm) == 2 and real_norm[1] == ":": raise RuntimeError(f"Refusing to delete drive root: {real}") low = real.lower() for bad in FORBIDDEN_PARTS: if bad in low: raise RuntimeError(f"Refusing to delete critical system path: {real}") if not any(_is_under(real_norm, r) for r in _allowed_roots_norm()): raise RuntimeError(f"Refusing to delete path outside allowed roots: {real}") return real ``` The runtime messages above are translated to English for report consistency; the path-validation logic is unchanged. ```python def collect(items, min_bytes): plan, rejected, busy = [], [], [] for it in items: try: safe = assert_safe(it["path"]) except RuntimeError as e: rejected.append((it["name"], str(e))) continue if it.get("guard") and process_running(it["guard"]): busy.append(it["name"]) continue size = dir_size(safe) if size < min_bytes: continue it = dict(it) it["path"], it["size"] = safe, size pla ...[truncated 2607 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/clean_cache.py:399
Finding

Personal application data and unselected trash are deleted as regenerable cache

Content
View full analysis
str: if os.name == "nt": try: import ctypes flags = 0x00000001 | 0x00000002 | 0x00000004 ctypes.windll.shell32.SHEmptyRecycleBinW(None, None, flags) return "Trash emptied" except Exception: return "Failed to empty trash" trash = os.path.join(HOME, ".local/share/Trash") if PLATFORM == "linux" \ else os.path.join(HOME, ".Trash") if os.path.isdir(trash): remove_tree(trash) return "Trash emptied" return "Skipped because no trash directory was found" ``` The runtime messages above are translated to English for report consistency; the destructive behavior is unchanged. ```python if not args.no_trash: print(f" [..] {empty_trash()}") ``` ### Technical Analysis The cleaner assigns GREEN, regenerable-cache treatment to directories that can contain persistent personal or application data: - `localHistory` can contain source-file recovery history. - `Local Storage`, `Session Storage`, and `WebStorage` can contain persistent application state, drafts, authentication state, and offline data. - `Partitions` can contain isolated profiles and application-specific storage. - `ModularData` is application-defined and cannot safely be assumed to be reproducible cache. These paths are coll ...[truncated 2107 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill describes and operationalizes shell, environment-variable, and file-system capabilities, including destructive deletion actions, but does not declare an explicit tool scope. That creates a least-privilege failure: the agent may invoke broader-than-expected tools in response to ordinary cleanup requests, increasing the chance of unsafe file deletion or command execution outside intended boundaries.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger phrases are broad enough to match many common storage or performance complaints, which can cause the skill to activate in situations where the user only wanted diagnosis, advice, or a non-destructive explanation. In this skill's context, over-broad activation is more dangerous because the skill is designed to progress from scanning to deletion via shell/file operations, so mistaken invocation can expose users to unnecessary destructive workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all operational guidance, warnings, and command usage in Chinese only. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This reference file enumerates many deletion targets, including system caches, logs, trash, and some sudo/root-required locations, but it does not consistently pair them with explicit safety warnings, restore limitations, or disruption notes. In the context of a disk-cleaning skill that may guide or automate cleanup, this increases the chance that dangerous paths are treated as routine cleanup targets, leading to accidental data loss, broken developer environments, or service disruption.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The docstring states discovered items are report-only unless explicitly enabled, but the implementation adds discovered items to the selectable plan by default and allows them to be deleted through normal selection. This weakens the stated safety model around heuristic matches, increasing the chance of deleting non-cache directories that merely resemble caches.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation says real deletion requires an explicit --yes, but the implemented CLI can proceed to interactive deletion without any such flag whenever --dry-run is not used. This safety-contract violation is dangerous in an agent skill context because surrounding automation may rely on the documented behavior and unintentionally trigger destructive file deletion.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/clean_cache.py (reported line 247)May include surrounding context.

python
try:
        import subprocess
        if os.name == "nt":
            out = subprocess.run(["tasklist"], capture_output=True, text=True,
                                 errors="ignore").stdout.lower()
        else:
            out = subprocess.run(["ps", "-eo", "comm="], capture_output=True, text=True,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/clean_cache.py (reported line 250)May include surrounding context.

python
out = subprocess.run(["tasklist"], capture_output=True, text=True,
                                 errors="ignore").stdout.lower()
        else:
            out = subprocess.run(["ps", "-eo", "comm="], capture_output=True, text=True,
                                 errors="ignore").stdout.lower()
        return any(n.lower() in out for n in names)
    except Exception:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script's target list includes user logs and developer artifacts such as ~/Library/Logs, crash dumps, and Xcode archives, which goes beyond narrow cache cleanup and can destroy potentially important diagnostic or recovery data. In a skill advertised as cache cleanup, this mismatch can mislead users into approving broader data removal than expected.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script empties the entire recycle bin/trash after cleanup unless --no-trash is passed, which is a broader destructive action than per-item cache deletion. This can permanently remove unrelated files the user expected to remain recoverable, especially because it is not individually selected alongside other cleanup items.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language content of the skill, including the manifest description and operating instructions, is entirely in Chinese. This can amount to a language policy violation if the organization expects language neutrality or user language choice and no opt-in or justified locale limitation is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file forces a single language presentation throughout the document and does not indicate that the language is optional, configurable, or region-specific. Per SQP-3, a skill artifact that imposes a specific language without user opt-in can constitute a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.