Back to skill

Security audit

智能文件整理助手Smartfolder Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a file organizer, but it needs review because it can move files and recursively scan sensitive folders more broadly than its safety text suggests.

Install only if you are comfortable with a local tool that can move files and scan file contents. Use --dry-run first, run it only on small explicitly chosen folders, avoid scanning your whole home directory, and review or remove the unnecessary pathlib dependency before installing.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/smartfolder.py:142
Finding

Recursive scans traverse hidden directories and read sensitive files

Content
View full analysis
= min_size: files.append(path) if not files: return {"duplicates": {}, "total_files": 0} # Calculate hashes hash_map = defaultdict(list) total = len(files) print(f"Scanning {total} files...") for i, file_path in enumerate(files, 1): if i % 100 == 0: print(f"Progress: {i}/{total}") try: file_hash = self._file_hash(file_path) hash_map[file_hash].append(file_path) except Exception as e: print(f"Error hashing {file_path}: {e}", file=sys.stderr) ``` ```python def _file_hash(self, file_path: Path, chunk_size: int = 8192) -> str: """Calculate MD5 hash of file""" hash_md5 = hashlib.md5() with open(file_path, "rb") as f: for chunk in iter(lambda: f.read(chunk_size), b""): hash_md5.update(chunk) return hash_md5.hexdigest() ``` ```python # Collect all files for path in directory.rglob("*"): if path.is_file() and not path.name.startswith('.'): try: stat = path.stat() mtime = datetime.fromtimestamp(stat.st_mtime) if cutoff_time and mtime > cutoff_time: continue files.append({ "path": path, "size": stat.st_size, "modified": mtime }) total_size += stat.st_size except Exception: pass ``` ```python if result["duplicates"]: print("\n[DUPLICATE FILES]:") for hash_val, paths in result["duplicates"].items(): print(f"\n Group (hash: {hash_val[:16]}...):") for ...[truncated 2579 chars]
Remediation
View remediation
bool: relative = path.relative_to(root) return any(part.startswith(".") for part in relative.parts) ``` 2. Use `os.walk()` and modify `dirnames` in place so hidden directories are not traversed at all: ```python for current_root, dirnames, filenames in os.walk(directory): dirnames[:] = [name for name in dirnames if not name.startswith(".")] ``` 3. Exclude known sensitive directories such as `.ssh`, `.aws`, `.gnupg`, credential stores, browser profiles, and keychains by default. 4. Require explicit confirmation before recursively scanning broad locations such as a home directory or filesystem root. 5. Add an opt-in option for hidden files instead of scanning them by default. 6. Catch errors around both `path.is_file()` and `path.stat()` so unreadable or transient files do not terminate collection unexpectedly. 7. Minimize output involving sensitive paths. Consider relative paths, optional redaction, or a machine-readable output mode with clear privacy warnings. 8. Update documentation so the stated privacy guarantees exactly match the implemented behavior, and add tests covering files beneath hidden parent directories. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/smartfolder.py:100
Finding

Symlinked category directories can redirect organized files outside the selected target

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unnecessary unpinned pathlib dependency expands the installation supply-chain surface

Content
View full analysis
=1.0.0 ``` The dependency is installed through the documented command: ```bash pip install -r requirements.txt ``` ### Technical Analysis The project requires Python 3.8 or later, where `pathlib` is already part of the Python standard library. Declaring the external `pathlib>=1.0.0` backport is therefore unnecessary. The open-ended version constraint does not pin a reviewed artifact and does not provide an integrity hash. Consequently, installation behavior depends on the configured package index and whichever matching release is selected at installation time. Python package installation may execute package-controlled build or installation logic. No evidence was found that the currently referenced `pathlib` package is malicious. The issue is the avoidable and mutable supply-chain trust introduced by installing a package that the application does not need. ### Attack Path 1. A user follows the project installation documentation. 2. The user runs `pip install -r requirements.txt`. 3. Pip queries the configured package index and resolves a release satisfying `pathlib>=1.0.0`. 4. If the index, account, selected artifact, or local package-index configuration has been compromised, a malicious artifact may be returned. 5. Pip processes the package and may execute attacker-controlled build or installation code with the privileges of the installing user. ### Impact Assessment A compromised dependency could execute code with the privileges of the account performing installation. Depending on those privileges, potential impact could include: - Reading or modifying user files. - Accessing credentials available to the installation process. - Installing persistence in ...[truncated 328 chars]
Remediation
View remediation
=1.0.0` from `requirements.txt`; Python 3.8 and later provide `pathlib` in the standard library. 2. If no external packages are required, remove the dependency installation step from `README.md` and `SKILL.md`, or explicitly state that no third-party dependencies are needed. 3. For any future dependencies: - Pin exact, reviewed versions. - Record cryptographic hashes. - Install with `pip install --require-hashes`. - Use a trusted and explicitly configured package index. - Review transitive dependencies and package ownership. - Run dependency vulnerability and provenance checks in CI. 4. Perform installations in an isolated virtual environment under a non-privileged account rather than using system-wide or elevated installation. ]]>
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README advertises organization, duplicate cleanup, and bulk renaming as 'safe operations' but does not prominently warn that these features can move, rename, or otherwise alter user files. This is dangerous because users or orchestrators may infer low risk from the description and invoke the skill on important paths without understanding the potential for destructive or hard-to-reverse filesystem changes.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger phrases are broad enough to match ordinary file-management requests such as cleaning folders, organizing downloads, or checking disk space. In an agent ecosystem, this can cause the skill to activate in situations the user did not specifically intend, leading to unplanned file analysis or reorganization actions on sensitive directories.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level description prominently markets automatic organization and cleanup, including potentially destructive file operations, without an equally prominent warning about data-loss risk or the need for preview/confirmation. This can cause users or orchestrators to treat the skill as routine housekeeping rather than a high-impact filesystem modifier.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases are broad enough to activate on common, ambiguous requests like 'clean up files' or 'organize my downloads folder', which can cause the skill to be selected in situations where the user did not explicitly intend bulk file operations. In a skill that can move, archive, or delete files, overbroad routing materially increases the risk of unintended destructive actions.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

Configuration

Create ~/.smartfolder/config.json for default settings:

json
{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The organize command performs real file moves immediately after parsing CLI arguments, without any explicit confirmation prompt, allowlist, or safety interlock beyond an optional dry-run flag. In the context of a natural-language-driven file organizer, this increases the risk of accidental bulk modification of user data if an agent misinterprets intent, targets the wrong directory, or is induced by prompt manipulation to run destructive reorganization on sensitive folders.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
50% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
# Core dependencies
pathlib>=1.0.0

# Optional: For image metadata extraction
# Pillow>=9.0.0

Static analysis

No suspicious patterns detected.