Back to skill

Security audit

dedicated-file-manager

Security checks for vulnerabilities and agentic risk

Overview

This file-management skill is not malicious, but it needs review because it can automatically move, rename, archive, scan, and schedule organization of user files with broad triggers and limited confirmation.

Install only if you are comfortable with an agent reorganizing files in the chosen workspace. Use dry-run first, require confirmation before all moves and renames, avoid pointing it at broad home/project roots, disable or carefully review weekly automation, and back up important folders before allowing non-dry-run organization.

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
scripts/organize_inbox.py:145
Finding

Archive Name Collision Can Overwrite Existing Files

Content
View full analysis

Vulnerability Details

File Location: scripts/organize_inbox.py, lines 145–153
Vulnerability Type: Unsafe destination handling during archival
Risk Level: Medium

Vulnerable Code

python
for item in scratch.iterdir():
    if item.is_file():
        mtime = datetime.fromtimestamp(item.stat().st_mtime)
        if mtime < cutoff:
            results["cleaned"].append(str(item))
            if not dry_run:
                # Move into archives
                archives = root / "archives"
                archives.mkdir(exist_ok=True)
                shutil.move(str(item), str(archives / item.name))

Technical Analysis

The archival operation constructs its destination directly from the source filename and calls shutil.move without checking whether that destination already exists:

python
archives / item.name

On platforms and filesystem configurations where moving to an existing file replaces that file, an old item from scratch/ can overwrite a same-named item already stored in archives/. This is inconsistent with the Skill's documented safety guarantees that files should not be overwritten or deleted and that archived versions should remain recoverable.

The inbox organization routine contains collision-safe renaming logic, but the old-temporary-file archival routine does not reuse it. The issue can be triggered through normal manual execution or through the optional scheduled organization workflow.

Attack Path

  1. A file already exists at archives/report.txt.
  2. A different file named report.txt is placed in scratch/.
  3. The scratch file's modification time becomes older than the configured retention threshold.
  4. The user or an approved scheduled task executes organize_inbox.py.
  5. clean_old_temp() calculates the destination as archives/report.txt.
  6. shutil.move() may replace the existing archived file without preserving the previous versio ...[truncated 628 chars]
Remediation
View remediation

Remediation Suggestions

  1. Check whether the archive destination exists before moving the source file.
  2. Reuse the collision-safe naming strategy already implemented for inbox organization, producing names such as report_01.txt.
  3. Perform collision handling atomically where possible to avoid time-of-check/time-of-use races.
  4. Catch and report filesystem exceptions instead of allowing a partial organization run to fail silently.
  5. Resolve and validate both source and destination paths, ensuring they remain beneath the configured workspace directories.
  6. Reject or handle symlinked archive directories explicitly to prevent destinations from being redirected outside the intended workspace.
  7. Add tests covering existing archive destinations, repeated filenames, concurrent operations, and platform-specific move semantics.

Example hardened logic:

python
archives = root / "archives"
archives.mkdir(parents=True, exist_ok=True)

target = archives / item.name
counter = 1
while target.exists():
    target = archives / f"{item.stem}_{counter:02d}{item.suffix}"
    counter += 1

shutil.move(str(item), str(target))
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (18)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/organize_inbox.py (reported line 28)May include surrounding context.

python
".html", ".css", ".scss", ".sass", ".less", ".vue", ".svelte",
        ".sh", ".bash", ".zsh", ".ps1", ".bat", ".cmd",
        ".sql", ".r", ".R",
        ".json", ".xml", ".yaml", ".yml", ".toml", ".ini", ".env"
    ],
    # 素材类 -> scratch/ (稍后由用户分类)
    "scratch": [

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/update_manifest.py (reported line 33)May include surrounding context.

python
".html", ".css", ".scss", ".sass", ".less", ".vue", ".svelte",
        ".sh", ".bash", ".zsh", ".ps1", ".bat", ".cmd",
        ".sql", ".r", ".R",
        ".json", ".xml", ".yaml", ".yml", ".toml", ".ini", ".env"
    ],
    # 素材类 -> scratch/ (稍后由用户分类)
    "scratch": [

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and trigger keywords are broad enough that the skill may activate for many ordinary conversations about files, cleanup, naming, or organization. In this skill context, unintended invocation is risky because the skill authorizes file-system-affecting actions such as moves, renames, scans, and automated organization, which can alter user data without a clearly bounded scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The safety principles at L018-L020 state '废弃文件只移入废弃目录,绝不自动删除' and require confirmation before destructive actions. However, the later decision rules only require confirmation for deletion cases at L608-L614, implying deletion is permitted under some circumstances, which conflicts with the earlier absolute 'never automatically delete' claim.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Module trigger phrases like '整理', '扫描', or '新项目' are ambiguous everyday language and can cause accidental loading of action-oriented modules. Because these modules may proceed to scan directories, classify files, rename them, or move them into managed folders, ambiguous activation increases the chance of unrequested file operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Forcing English-only naming conventions on code/technical projects without user opt-in can trigger widespread renames that may conflict with existing repository conventions, localized workflows, or path-based dependencies. In this skill, the danger is amplified because renaming is operationalized as an executable step rather than a suggestion, so the policy can cause unintended compatibility and maintainability issues.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill allows direct execution of file moves, renames, directory creation, and inbox organization without requiring a prior warning or confirmation in several cases. Even if these actions are framed as non-destructive, they can materially disrupt workflows, break file references, relocate important assets, and make recovery difficult—especially under automated or broad-trigger invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The guidance explicitly authorizes an agent to automatically rename files to enforce naming rules, including adding prefixes to numeric filenames and attempting to repair garbled characters. In an agent context, automatic renaming can break references, scripts, imports, links, or user expectations if performed without explicit confirmation, preview, rollback, or warnings about side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document explicitly defines automatic file movement, classification, and archival rules for an agent-managed workspace, including weekly inbox sorting and auto-archiving scratch files older than 30 days, but it does not require user confirmation, preview, opt-in, or recovery safeguards. In a file-management skill, this is operationally risky because an agent could reorganize or hide user files in ways the user did not expect, causing data loss, broken workflows, or loss of visibility even if the behavior is not malicious.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This is a natural-language policy issue because the script title, docstring, report text, and command-line help are written only in Chinese, which effectively imposes a specific language on users. The file does not provide any opt-in, locale selection, or justification for the language restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code moves files out of the inbox and later moves older scratch files into archives, which are safety-relevant filesystem modifications. Although a dry-run mode exists, there is no confirmation prompt or explicit warning before the non-dry-run path changes user files, and the help text does not clearly warn about these side effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring and all user-facing strings are written only in Chinese, with no indication that other languages are supported or that the locale is intentionally constrained. Per the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

M11 specifies '扫描项目目录(深度 3 层)' as the execution flow for new project intake. But the tooling section at L632-L634 documents a generic scan script with a configurable '--max-depth' parameter, which can be used beyond 3 levels, contradicting the stated bounded scan behavior for that workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file is entirely written in Chinese, including headings, labels, and descriptions, without offering any language choice or stating that the skill is intentionally region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The section for code files explicitly says 'use English' and prohibits Chinese, presenting a fixed language policy. This is a natural-language locale/language restriction without any opt-in choice or explanation that it is required for a specific project, region, or tooling context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The entire skill description, template labels, and invocation example are presented only in Chinese, with no indication that users may choose another language. This can be a language policy issue when a skill effectively forces a specific language without opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code performs a file write via Path(args.output).write_text, which can overwrite or create a file on disk. While the --output argument implies writing, there is no confirmation prompt, cautionary comment/docstring, or stronger user-facing warning near the write operation about modifying filesystem state.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code file contains natural-language strings entirely in Chinese, including the module docstring and command-line description, which imposes a specific language on users without opt-in or alternative locale support. The policy for this audit flags language-forcing behavior when no user choice or justification is provided.

Content

No source excerpt is available for this finding.