Back to skill

Security audit

downloads-command-center

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent local Downloads organizer, but its optional apply mode has insufficient path and overwrite safeguards for file-moving operations.

Review before installing. Use preview output first, use only trusted rules files, avoid running --apply on broad or sensitive directories, and check for destination collisions or unexpected paths before allowing any move operation.

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_downloads.py:10
Finding
Unvalidated Rule Group Names Permit Destination Path Escape and File Overwrite## Vulnerability Details **File Location**: `scripts/organize_downloads.py`, lines 10–34 **Vulnerability Type**: Unvalidated path construction and path traversal **Risk Level**: Medium ### Vulnerable Code ```python def detect_group(ext, groups): ext = ext.lower() for name, exts in groups.items(): if ext in exts: return name return "other" def main(): ap = argparse.ArgumentParser() ap.add_argument("folder", help="Downloads folder") ap.add_argument("--rules", default="resources/rules.sample.json") ap.add_argument("--apply", action="store_true", help="Actually move files") args = ap.parse_args() rules = load_rules(args.rules) folder = Path(args.folder) moves = [] for item in folder.iterdir(): if item.is_file(): group = detect_group(item.suffix, rules["groups"]) target_dir = folder / group / item.stat().st_mtime_ns.__str__()[:7] target = target_dir / item.name moves.append({"source": str(item), "target": str(target), "group": group}) if args.apply: target_dir.mkdir(parents=True, exist_ok=True) shutil.move(str(item), str(target)) ``` ### Technical Analysis The group name is obtained from a caller-selected JSON rules file and used directly as a filesystem path component. The implementation does not reject absolute paths, path separators, `.` or `..` components. It also does not resolve the resulting destination and verify that it remains beneath the user-selected folder. A malicious rule name such as `../../external` can therefore cause the computed destination to escape the intended Downloads directory. An existing symlink used as a group directory could produce a similar scope escape. The `--apply` branch creates the destination directories and calls `shutil.move` without checking whether the destination already exists. Depend ...[truncated 1504 chars]
Remediation
## Remediation Suggestions 1. Treat every group name loaded from a rules file as untrusted input. 2. Require group names to be safe single path components. Reject absolute paths, empty names, `.` and `..`, directory separators, and platform-specific alternate separators. 3. Resolve the base folder and every proposed destination, then verify confinement before previewing or moving: ```python base = folder.resolve() destination = (base / group / date_part / item.name).resolve() if destination != base and base not in destination.parents: raise ValueError(f"Destination escapes the selected folder: {destination}") ``` 4. Do not follow attacker-controlled symlinked destination components. Validate each existing component with `lstat()` or use platform facilities that provide directory-relative, no-follow operations where available. 5. Check `target.exists()` before moving. Refuse collisions by default and require an explicit user-selected policy for renaming, skipping, or overwriting. 6. Validate the complete rules schema, including group-name and extension types, before processing any files. 7. Revalidate all destinations immediately before the apply operation rather than relying only on an earlier preview. 8. Add regression tests covering absolute group names, `../` traversal, nested separators, symlink escapes, and existing destination collisions.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The skill promises narrowly scoped, structured Downloads organization, but the described and detected behavior can operate on any provided folder and does not implement several advertised constraints such as project/action-state organization. This mismatch is security-relevant because users may grant trust and approve file operations under false assumptions about scope and safeguards, increasing the chance of unintended modification of unrelated directories.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The trigger phrase "rename recent files" is generic and could match many ordinary requests unrelated to organizing the Downloads folder. The README does not pair these trigger examples with exclusion conditions or constraints limiting invocation to the Downloads-organizing context.

Lp3

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding
The skill declares a local helper script and instructs inspection of a user-supplied folder, but it does not declare an explicit tool scope such as file access boundaries or allowed tools. In an agent environment, this can lead to overbroad file-reading behavior because the model may apply the skill to arbitrary paths rather than a narrowly constrained Downloads directory.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The trigger phrase 'rename recent files' is broad enough to activate this skill for generic file-renaming requests outside the stated Downloads-focused use case. In a file-manipulation skill, overbroad activation increases the risk that the agent applies the wrong workflow to unrelated files or directories, especially when combined with a helper script that can inspect user-specified paths.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The trigger phrases are broad enough to overlap with ordinary file-management requests, which can cause the skill to activate in situations the user may not have intended. In a skill that plans file renaming, movement, duplicate quarantine, and cleanup actions, overbroad invocation increases the risk of unintended handling of local files or confusing the user about what actions are being proposed.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
The top-level docstring describes the script as a preview tool, which implies non-mutating behavior. However, the implementation includes an --apply mode that creates directories and moves files, so the documentation actively understates the script's side effects.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This markdown file presents all operational instructions and acceptance criteria in Chinese, with no indication that other languages are supported or that Chinese is an opt-in choice. Under the policy for natural-language violations, forcing a specific language without user opt-in is reportable.

Natural-Language Policy Violations

Low
Confidence
77% confidence
Finding
The document presents core usage sections in Chinese while also using English content, but it does not state whether the skill supports multiple languages or let the user opt into a preferred language. This can create an implicit language/locale constraint in the skill's natural-language interface.

Natural-Language Policy Violations

Low
Confidence
76% confidence
Finding
The document presents user-facing instructions and examples in a mixed Chinese/English format, but it does not state whether the user can choose the response language or locale. This can amount to an implicit language policy choice without explicit opt-in.

Missing User Warnings

Low
Confidence
86% confidence
Finding
This code can reorganize a user-specified downloads folder by creating directories and moving files when `--apply` is used. Although the flag name implies action, the file contains no explicit user-facing warning, confirmation prompt, or comment/docstring explaining that running with `--apply` will modify the filesystem.

Static analysis

No suspicious patterns detected.