Back to skill

Security audit

Download Organizer

Security checks for vulnerabilities and agentic risk

Overview

This is a file organizer, but its undo feature trusts an editable backup file and can copy or delete unintended files, so it should be reviewed before use.

Install only if you are comfortable with a script that can read, copy, and delete files under your user account. Use preview first, keep input and output paths limited to a non-sensitive downloads area, and do not run undo if .download-organizer-backup.json could have been modified or created by someone else.

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
download_organizer.py:31
Finding
Untrusted Backup Mappings Allow Arbitrary File Copy and Deletion## Vulnerability Details **File Location**: `download_organizer.py:31-34, 95-108` **Vulnerability Type**: Unvalidated file paths from a writable backup file **Risk Level**: Medium ### Vulnerable Code ```python def load_backup(self): if self.backup_file.exists(): with open(self.backup_file, 'r', encoding='utf-8') as f: self.backup_data = json.load(f) return self.backup_data ``` ```python reverse_mappings = {v: k for k, v in backup.items()} count = 0 for new_str, old_str in reverse_mappings.items(): new_path = Path(new_str) old_path = Path(old_str) if new_path.exists() and not old_path.exists(): copy2(new_path, old_path) new_path.unlink() print(f"撤销: {new_path.name} -> {old_path.name}") count += 1 ``` ### Technical Analysis The `undo` operation treats every source and destination path in `.download-organizer-backup.json` as trusted. The code does not validate the JSON schema, canonicalize and constrain paths to approved directories, reject symbolic links, or verify that each mapping was created by a previous legitimate organization operation. During undo, the JSON mapping is reversed. An attacker-controlled mapping can therefore select any existing path as `new_path` and any absent path as `old_path`. If the process has sufficient permissions, `copy2(new_path, old_path)` copies the selected source to the attacker-chosen destination, after which `new_path.unlink()` deletes the source. The `old_path.exists()` check limits straightforward replacement of an existing destination but does not prevent creation at an arbitrary absent path. It also introduces a time-of-check/time-of-use window because the destination is checked separately from the subsequent copy operation. ### Attack Path 1. The attacker gains write access to the output directory or plants/modifies `.download-organizer-backup.json`. 2. The attacker inserts a JSON mapping whose key is an arbitrary desired restoration destina ...[truncated 1144 chars]
Remediation
## Remediation Suggestions 1. Store only normalized relative paths in the backup rather than unrestricted absolute paths. 2. Resolve every source and destination using `Path.resolve()` and require them to remain under explicitly configured input and output roots. 3. Reject mappings containing traversal components, unexpected value types, or paths outside the authorized roots. 4. Define and enforce a strict JSON schema before processing any mappings. 5. Reject symbolic links in the backup path, source paths, destination paths, and relevant parent directories. 6. Protect the backup file with restrictive permissions and refuse to load files owned by an unexpected user. 7. Revalidate containment and file type immediately before every copy and deletion. 8. Avoid check-then-act destination handling. Use filesystem operations that fail atomically if the destination already exists. 9. Delete a source only after confirming that it is an expected organized copy and that the restoration completed successfully. 10. Consider authenticating backup contents or storing operation state in a user-private application data directory.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The skill description and instructions are written entirely in Chinese, while the file does not indicate that the tool is region-specific or offer an English or user-selectable language option. Under the policy, forcing a specific language without opt-in is a natural-language locale violation.

Intent-Code Divergence

Medium
Confidence
77% confidence
Finding
L033 explicitly says files will be 'copied' into the organized folders. Elsewhere, the README describes '撤销操作' and '执行前会自动保存备份', which implies the real operation may be moving or otherwise mutating files rather than just making categorized copies. This is an intent/documentation inconsistency within the skill documentation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill describes functionality that necessarily reads from and writes to the filesystem, but it does not declare any explicit tool scope or permission boundaries. This is dangerous because an agent may execute the skill with broader file access than users expect, increasing the chance of unintended file moves, overwrites, or access to sensitive directories.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The manifest description and primary heading are written in Chinese, and the document continues in Chinese without indicating multilingual support or user choice. This creates a language/locale policy concern because the skill appears to require a specific language experience by default rather than offering an opt-in or alternative.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The script's user-facing strings and CLI description are written in Chinese, including preview output, confirmation prompts, status messages, and argument help text. This imposes a specific language on users without any opt-in or documented locale constraint, which matches the policy violation criteria for language/locale restrictions.

Static analysis

No suspicious patterns detected.