Back to skill

Security audit

smart-file-organizer-pro

Security checks for vulnerabilities and agentic risk

Overview

This is a local file organizer, but it can immediately move, rename, and sometimes delete many files with weak rollback and boundary controls.

Review before installing. Use this only on test or backed-up directories first, run preview mode before applying changes, avoid custom config files from untrusted sources, do not enable duplicate deletion unless you have separate backups, and do not rely on the advertised undo/history features as complete recovery protection.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/organize.py:287
Finding

Unvalidated Configuration Paths Can Move Files Outside the Selected Directory

Content
View full analysis
Path: """创建归档目录结构""" date_format = self.config["归档设置"].get("日期格式", "YYYY/MM/DD") # 转换日期格式 archive_path = date_format archive_path = archive_path.replace("YYYY", str(file_date.year)) archive_path = archive_path.replace("MM", f"{file_date.month:02d}") archive_path = archive_path.replace("DD", f"{file_date.day:02d}") full_path = base_path / "Archive" / archive_path return full_path ``` ```python # 分类模式 if mode["分类"]: target_dir = base_path / category # 生成新文件名 new_filename = filepath.name if mode["重命名"] and self.config["重命名规则"]["启用"]: with self.lock: new_filename = self.generate_new_filename( filepath, category, self.stats["organized_files"] + 1 ) self.stats["renamed_files"] += 1 target_path = target_dir / new_filename # 处理文件名冲突 if target_path.exists() and target_path != filepath: counter = 1 stem = target_path.stem while target_path.exists(): target_path = target_dir / f"{stem}_copy{counter}{filepath.suffix}" counter += 1 if preview: with self.lock: self.log_operation(f"[预览] {icon} {filepath.name} → {category}/{new_filename}") else: # 创建目标目录 target_dir.mkdir(exist_ok=True) # 备份 if self.config["安全设置"]["自动备份"]: backup_dir = base_path / "Backup" backup_dir.mkdir(exist_ok=True) self.backup_file(filepath, backup_dir) # 移动文件 shutil.move(str(filepath), str(target_path)) ``` ### Technical Analysis Category directory names, archive formats, and filename templates can be supplied through a user ...[truncated 1850 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/organize.py:363
Finding

Duplicate Processing Can Overwrite Files Without Backup or Collision Protection

Content
View full analysis
`. It does not invoke the backup routine used by the normal organization branches. The move operation also lacks destination collision handling. Different duplicate files from separate subdirectories may share the same basename and therefore target the same destination. A pre-existing file in `Duplicates` creates the same condition. Behavior can vary by platform and destination type: the operation may fail, replace an existing file, or produce inconsistent results. Although the shown move occurs while holding `self.lock`, the code still does not protect against pre-existing collisions, filesystem changes by other processes, or destructive replacement behavior. The `delete` action is directly irreversible through this Skill. Default standard mode enables duplicate detection, so this behavior is reachable during ordinary use. ### Attack Path 1. Place identical files with the same basename in multiple subdirectories under the selected directory, or pre-create `Duplicates/`. 2. Run standard or d ...[truncated 1093 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/organize.py:616
Finding

Non-Serializable Timestamps Prevent Reliable History Creation After File Moves

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/undo.py:129
Finding

Undo Restores All Flattened Backups Instead of the Selected Operation

Content
View full analysis
10: print(f" ... 还有 {len(backup_files) - 10} 个文件") print() print(f"{Colors.WARNING}要实际恢复文件,请使用 --confirm 参数{Colors.ENDC}") return True # 确认操作 if not preview: confirm = input(f"{Colors.WARNING}确认要恢复备份文件?这将覆盖当前文件 (yes/no): {Colors.ENDC}") if confirm.lower() not in ['yes', 'y']: print(f"{Colors.WARNING}操作已取消{Colors.ENDC}") return False # 执行恢复 print(f"{Colors.OKCYAN}正在恢复文件...{Colors.ENDC}") restored = 0 errors = 0 for backup_file in backup_files: try: target_path = self.base_path / backup_file.name # 处理文件名冲突 if target_path.exists(): counter = 1 stem = backup_file.stem while target_path.exists(): target_path = self.base_path / f"{stem}_restored{counter}{backup_file.suffix}" counter += 1 shutil.copy2(backup_file, target_path) restored += 1 print(f" {Colors.OKGREEN}✓{Colors.ENDC} {backup_file.name}") except Exception as e: errors += 1 print(f" {Colors.FAIL}✗{Colors.ENDC} {backup_file.name}: {e}") ``` The corresponding backup implementation stores every backup in one shared, flattened directory: ```python def backup_file(self, filepat ...[truncated 2371 chars]
Remediation
View remediation
/ ``` 2. Record a manifest entry for every modification, including: - Original absolute or base-relative path - Organized destination - Backup path - File size - Cryptographic hash - Operation type - Completion status 3. Restore only entries associated with the selected operation ID. 4. Preserve relative directory structure under the operation-specific backup directory. 5. During undo, validate that every restored path remains under `base_path`. 6. Verify backup hashes before restoration and detect changes to current destination files before overwriting or removing them. 7. Reverse both sides of the operation: restore the original file and safely remove or relocate the organized copy only when its recorded hash still matches. 8. Never delete the shared backup collection after restoring a single operation. Delete only the selected operation's backup after successful, verified rollback and explicit confirmation. 9. Make rollback transactional where possible, and preserve the manifest if any restoration step fails. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (30)

Tp4

High
Category
MCP Tool Poisoning
Confidence
87% confidence
Finding

描述将该技能定位为具备实际文件整理能力的增强版助手,而提供的代码仅分析目录内容并打印报告/建议。虽然它与“文件整理”主题相关,但主功能是分析而非整理,且描述中列出的关键增强功能(按日期归档、多模式预设、进度显示、操作历史)在代码中都没有真正实现。代码还包含一个未完成的 JSON 输出选项,进一步说明实现与描述存在明显差距。因此应判定为描述与行为不符。

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 48)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 51)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 54)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 57)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 63)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 72)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 78)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 319)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 325)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 331)May include surrounding context.

md
python3 scripts/organize.py --path . --mode simple

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README advertises '友好的中文提示' as a built-in experience, and the document is entirely written as Chinese-first usage guidance for the skill. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation unless a language choice or clear regional justification is provided.

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.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The usage examples encourage commands that can move, rename, deduplicate, and archive user files, but they do not prominently warn that these are destructive or state-changing operations. Users may run examples directly and unintentionally modify important data, especially because preview mode is shown as optional rather than strongly recommended first.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Undo, backup restore, and backup cleanup operations can overwrite current state or delete stored recovery data, yet the documentation lacks clear risk disclosures. In practice, users could lose data or make recovery harder by running restore/clean commands without understanding their side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

A watch/monitor mode implies ongoing automatic modification of newly added files, which materially raises the risk of unexpected file moves or renames over time. Without a clear warning about continuous background changes, users may enable it in sensitive directories and later lose track of files or disrupt other workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file presents its description and user-facing behavior entirely in Chinese, and the CLI help/messages throughout the script are also hard-coded in Chinese. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing descriptions, help text, and output messages in Chinese only. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation unless the tool is clearly documented as region-specific, which is not shown here.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest description emphasizes a smart file organizer with history support, and this file's docstrings describe viewing and managing operation history. However, the --export path allows writing collected history data to any file path, which is a broader file-output capability than simply inspecting or internally managing history records.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

A history viewer/manager would be expected to read and display prior organizer actions, but this code also writes JSON to any path supplied with --export. That general file-writing capability is not obviously required by the stated purpose of reviewing operation history unless export behavior is explicitly in scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The tool can delete duplicate files when the configuration sets the duplicate handling action to 'delete', but this destructive behavior is not disclosed in the skill metadata. In a file-organizer context, undisclosed deletion materially increases risk because users may expect moves/renames only and can suffer irreversible data loss if duplicate detection is wrong or unexpectedly enabled.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The tool performs recursive, directory-wide moves, renames, and potentially deletions immediately after argument parsing, with no mandatory confirmation step and only an optional preview mode. In a bulk file-operation utility, lack of a hard safety checkpoint makes accidental destructive execution much more likely, especially when pointed at the wrong directory or used with custom config that enables deletion.

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 and all user-facing descriptions are written only in Chinese, and the script does not indicate any option to switch language or obtain user consent for that locale choice. This is a natural-language policy issue because the skill imposes a specific language on users rather than offering a choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.