Back to skill

Security audit

File Cleaner ZH

Security checks for vulnerabilities and agentic risk

Overview

This file-organizer skill does what it says broadly, but it can immediately move many user files without a preview, confirmation, or rollback plan.

Install only if you are comfortable with a Chinese-language skill that can reorganize real files. Use it on test folders first, avoid pointing it at Desktop/Downloads/Documents until backups exist, and prefer a version that previews planned moves and asks for explicit confirmation before changing files.

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

T09 · Insecure Skill Coding Practices

Warning
Location
index.js:126
Finding

Filesystem Reorganization Executes Without Explicit User Confirmation

Content
View full analysis

Vulnerability Details

File Location: index.js, lines 126-206
Vulnerability Type: Unconfirmed destructive filesystem operation
Risk Level: Medium

Vulnerable Code

js
// Activation condition
activate(message) {
  const keywords = ['整理', '分类'];
  return keywords.some(k => message.includes(k));
},

async handle(context) {
  const message = context.message || '';
  const lowerMessage = message.toLowerCase();

  // Resolve the target path
  let targetPath = null;

  if (lowerMessage.includes('桌面')) {
    targetPath = path.join(process.env.USERPROFILE || '', 'Desktop');
  } else if (lowerMessage.includes('下载')) {
    targetPath = path.join(process.env.USERPROFILE || '', 'Downloads');
  } else if (lowerMessage.includes('文档')) {
    targetPath = path.join(process.env.USERPROFILE || '', 'Documents');
  }

  // Query requests only display statistics
  if (lowerMessage.includes('统计') || lowerMessage.includes('查看')) {
    const stats = generateReport(scanResults);
    // Report generation omitted
    return { message: msg };
  }

  // All other matching requests immediately reorganize the files
  const organizeResults = organizeFiles(scanResults.files, targetPath);
}

The resulting filesystem operation is implemented at index.js, lines 67-103:

js
function organizeFiles(files, targetDir) {
  const results = {
    moved: [],
    errors: []
  };

  const categories = [...new Set(files.map(f => f.type))];

  for (const category of categories) {
    const categoryDir = path.join(targetDir, category);
    if (!fs.existsSync(categoryDir)) {
      fs.mkdirSync(categoryDir, { recursive: true });
    }
  }

  for (const file of files) {
    try {
      const targetPath = path.join(targetDir, file.type, file.name);

      let finalPath = targetPath;
      let counter = 1;
      while (fs.existsSync(finalPath)) {
        const nameWithoutExt = path.basename(file.name, file.ext);
        finalPath = path.join(
          targetDir,
          file
...[truncated 3542 chars]
Remediation
View remediation

Remediation Suggestions

  1. Default to preview-only behavior. Display the resolved absolute path, affected file count, category mapping, and proposed source-to-destination operations without modifying the filesystem.

  2. Require explicit confirmation. Execute only after a separate confirmation message that includes or cryptographically binds the exact target path and preview identifier. Generic organization-related wording must not authorize filesystem changes.

  3. Use an explicit execution mode. Separate commands such as preview, confirm, and cancel. Do not infer permission to mutate files merely from the absence of statistics-related keywords.

  4. Create a rollback manifest. Before moving files, persist an atomic manifest containing every original and destination path. Provide a restore operation that validates the manifest and reverses completed moves.

  5. Restrict allowed roots. Require target directories to be inside administrator- or user-configured safe roots. Resolve paths with path.resolve, verify containment, and reject unexpected system or application directories.

  6. Handle missing environment variables safely. Do not construct relative fallback paths such as Desktop when USERPROFILE is absent. Return an error and request an explicit absolute path instead.

  7. Reduce activation ambiguity. Require a specific command or structured invocation rather than broad substring matching.

  8. Make execution failure-safe. Validate all proposed destinations before the first move. If any move fails, either roll back completed operations or clearly report the exact partial state.

  9. Add tests for authorization boundaries. Verify that ambiguous messages, indirect content, preview requests, absent environment variables, and malformed paths cannot trigger filesystem mutation.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill advertises '识别并清理重复文件' without any warning that cleanup may be destructive, especially if duplicates are misidentified or removed automatically. In the context of filesystem operations, users may reasonably assume safe organization behavior, making silent deletion or irreversible cleanup materially dangerous.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description and tags explicitly frame this as a Chinese-version skill, but the file does not indicate that language choice is optional or user-selectable. This can violate language/locale policy when a specific language is imposed without opt-in or documented justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are very generic words such as '整理' and '分类', which are common in normal conversation and can cause the skill to activate unexpectedly. In a file-management skill that can reorganize or clean up files, accidental invocation increases the risk of unintended moves, reclassification, or deletion-like cleanup actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description, trigger keywords, and user-facing responses are all written in Chinese, and activation depends on Chinese keywords like '整理' and '分类'. There is no indication that the user can choose another language or that the locale restriction is explicitly documented as an intentional regional limitation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill performs destructive filesystem changes immediately after parsing a natural-language request, with no explicit confirmation, preview, or dry-run step. Because it targets common user directories like Desktop and Downloads, a vague or accidental trigger can unexpectedly reorganize many files, causing disruption, broken workflows, or apparent data loss.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

The package name, description, and keywords explicitly label the skill as Chinese-only ('zh', '中文版', '中文') without any indication that users can choose another language or opt in to this locale constraint. This may violate language/locale policy if the skill imposes a specific language by default rather than offering a choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This manifest describes the skill generically as a Chinese file organizer and includes broad keywords like '效率' and '工具', but does not specify concrete trigger phrases, scope limits, or exclusion conditions. In a manifest file, this can make activation ambiguous and increase the chance of unintended invocation from ordinary requests about productivity or tools.

Content

No source excerpt is available for this finding.