Back to skill

Security audit

Fileclean

Security checks for vulnerabilities and agentic risk

Overview

This filename-cleaning skill is mostly coherent, but its apply mode can rename files in place without collision checks, which can cause accidental file loss.

Use preview mode first and avoid running --rename on important folders unless you have a backup. The publisher should add collision detection, refuse existing destination names by default, and document rollback or recovery steps before this is treated as low-risk.

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

Error
Location
tool.py:83
Finding

Unsafe File Overwrite During Filename Normalization

Content
View full analysis

Vulnerability Details

File Location: tool.py, lines 83–88
Vulnerability Type: Unchecked destination collision and destructive file overwrite
Risk Level: High

python
if args.rename:
    print("\nRenaming files...")
    for old, new in changes:
        os.rename(old, new)
        print(f"Renamed: {os.path.basename(old)} -> {os.path.basename(new)}")
    print("Done.")

Technical Analysis

The application derives destination filenames by removing dates, UUIDs, hexadecimal strings, and separators, but it does not verify whether a destination already exists or whether multiple source files normalize to the same destination.

The resulting paths are passed directly to os.rename(). On platforms where this operation replaces an existing destination, a pre-existing file can be silently overwritten. This is particularly dangerous because an entirely hexadecimal basename such as abcd.txt is normalized to file.txt. The code also does not detect duplicate destination paths in the planned batch or revalidate destinations immediately before each operation, leaving collision and time-of-check/time-of-use risks.

Attack Path

  1. An attacker places a crafted source file, such as abcd.txt, in a directory containing a valuable file named file.txt.
  2. The victim supplies that directory to the tool and enables the destructive operation with --rename.
  3. Filename normalization removes the hexadecimal basename and substitutes the fallback name file, producing file.txt.
  4. The rename loop calls os.rename("abcd.txt", "file.txt") without checking the destination.
  5. On a platform with replacement semantics, the valuable destination file is overwritten by the attacker-controlled source file.

A similar collision can occur when two different source filenames independently normalize to the same destination during one batch.

Impact Assessment

Successful exploitation can cause irreversible rep ...[truncated 332 chars]

Remediation
View remediation

Remediation Suggestions

  • Build and validate the complete rename plan before modifying the filesystem.
  • Reject any operation whose destination already exists unless the source and destination identify the same file.
  • Detect duplicate normalized destinations across all planned changes and fail safely with a clear collision report.
  • Prefer generating a unique destination suffix rather than replacing an existing file.
  • Revalidate destination availability immediately before every rename to reduce race-condition exposure.
  • Use an atomic no-replace operation where the operating system supports it.
  • Handle rename failures explicitly and report partial completion so users can recover safely.
  • Add tests covering existing destinations, multiple sources normalizing to one name, fallback names such as file.txt, and concurrent destination creation.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explicitly shows a --rename operation that will modify filenames in place, but the documentation provides no warning about destructive or hard-to-reverse effects such as breaking links, workflows, or batch-renaming the wrong targets. While not inherently malicious, presenting a write action without cautionary guidance increases the chance of user error and unintended file changes.

Content

No source excerpt is available for this finding.