Back to skill

Security audit

rename-file

Security checks for vulnerabilities and agentic risk

Overview

This skill performs the advertised batch rename task, but its safeguards are under-enforced and its prefix handling can move files outside the chosen folder.

Review carefully before installing. Use only on backed-up folders, avoid untrusted prefixes, and do not use prefixes containing slashes, backslashes, or traversal strings such as ../. The safer version would enforce dry-run/execute modes and verify every destination stays inside the selected directory.

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
scripts/rename-files.js:19
Finding

Path Traversal in User-Controlled Rename Prefix Allows Files to Be Moved Outside the Selected Directory

Content
View full analysis
name unchanged`); continue; } const oldPath = path.join(dirPath, oldName); const newPath = path.join(dirPath, newName); // Check if target already exists if (fs.existsSync(newPath)) { console.error(`Error: Cannot rename "${oldName}" -> "${newName}" (file already exists)`); continue; } operations.push({ oldPath, newPath, oldName, newName }); } ``` The resulting destination is subsequently used in a filesystem rename operation: ```js for (const op of operations) { try { fs.renameSync(op.oldPath, op.newPath); console.log(`✓ ${op.oldName} -> ${op.newName}`); results.success++; ``` ### Technical Analysis The script treats the user-supplied prefix as a filename component, but it does not reject path separators or traversal components such as `../`. Consequently, `newName` can represent a relative path rather than a filename. For example, given a selected directory `/data/photos`, an existing sibling directory `/data/archive`, and the following prefix: ```text ../archive/backup_ ``` A source file named `image.jpg` produces: ```text newName = ../archive/backup_image.jpg newPath = ...[truncated 2242 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill documentation promises an interactive safety flow with preview and explicit confirmation, but the described execution step invokes a Node.js script directly with command-line arguments, and the script details indicate it performs synchronous renames rather than enforcing confirmation itself. If the surrounding agent fails to implement the preview/confirmation logic exactly as documented, this creates a real risk of unintended bulk file modification in arbitrary user-supplied directories.

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 107)May include surrounding context.

md
The JavaScript script (`scripts/rename-files.js`):

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script immediately performs filesystem changes once invoked, despite the skill description claiming there will be a preview and confirmation step. This mismatch can mislead a user or calling agent into assuming a safety checkpoint exists, increasing the chance of unintended bulk renames and data disruption in user-specified directories.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.