Back to skill

Security audit

Template Tool

Security checks for vulnerabilities and agentic risk

Overview

The skill is presented as a simple text-template processor, but it also bundles an under-disclosed project scaffold generator that can write and overwrite files outside the intended output directory.

Review this skill before installing. Only use it if you want a code scaffold generator as well as a text-template processor, run it in a controlled project directory, avoid untrusted template names or output paths, and inspect generated files before executing them.

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/template.py:293
Finding
Path Traversal Enables Arbitrary File Creation and Overwrite## Vulnerability Details **File Location**: `scripts/template.py`, lines 293–310 **Vulnerability Type**: Path traversal and unrestricted file write **Risk Level**: High ### Vulnerable Code ```python # Convert name to appropriate format safe_name = name.replace(' ', '_').replace('-', '_') class_name = ''.join(word.capitalize() for word in name.replace('-', ' ').split()) print(f"Creating {template['description']} in {output_dir}/") for filename, content in template['files'].items(): # Replace placeholders filename = filename.format(name=safe_name, Name=class_name) content = content.format(name=safe_name, Name=class_name) file_path = output_path / filename # Create parent directories file_path.parent.mkdir(parents=True, exist_ok=True) # Write file with open(file_path, 'w') as f: f.write(content) ``` ### Technical Analysis The `name` argument is attacker-controlled. Its only sanitization replaces spaces and hyphens with underscores; it does not reject path separators, absolute paths, `.` components, or `..` traversal components. Templates such as `class` and `react` use `{name}` in generated filenames. After placeholder formatting, the resulting filename is joined to the requested output directory without canonicalization or a containment check. A value containing `../` can therefore escape the intended output directory. An absolute path can also cause `pathlib.Path` to disregard the preceding output directory. The code creates missing parent directories and opens the destination using mode `w`. Consequently, it can create files outside the output directory or silently truncate and replace an existing file. No explicit overwrite confirmation, exclusive file creation, resolved-path validation, or symbolic-link protection is present. ### Attack Path 1. An attacker or untrusted caller invokes the generator with a template whose filename contains `{name}`, such as `c ...[truncated 1483 chars]
Remediation
## Remediation Suggestions 1. Enforce a strict allowlist for generated names. For example, accept only identifiers matching an appropriate expression such as `^[A-Za-z_][A-Za-z0-9_]*$`. 2. Explicitly reject absolute paths, `/`, `\`, null bytes, `.` components, and `..` components in values used to construct filenames. 3. Resolve both the output root and candidate destination, then verify that the destination remains beneath the output root before creating directories or opening the file. 4. Reject symbolic-link destinations and consider opening files through a directory file descriptor with platform-appropriate no-follow protections where hostile users can modify the output tree. 5. Use exclusive creation mode (`x`) by default so existing files are not silently overwritten. Require an explicit, clearly documented option to permit replacement. 6. Keep display names separate from filesystem-safe names rather than applying partial character substitutions to untrusted input. 7. Add regression tests covering `../name`, absolute paths, nested traversal, alternate path separators, symbolic links, and attempts to overwrite existing files. 8. Align `SKILL.md` with the actual bundled functionality so users understand that `scripts/template.py` generates and writes project files, including the affected security boundary.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
A mismatch between the declared purpose and the actual behavior is security-relevant because it can hide materially riskier operations behind an innocuous description. If the implementation creates files/directories or generates project scaffolds beyond simple template substitution, users and policy systems may grant trust or access based on incomplete information, increasing the chance of unexpected filesystem modification.

Credential Access

High
Category
Privilege Escalation
Content
.Python
env/
venv/
.env

# Node
node_modules/
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The skill advertises file read/write behavior through its usage and examples, but it does not declare any explicit tool scope such as permissions or allowed-tools. That creates an authorization and transparency gap: consumers may invoke a skill that can access or modify files without clear policy constraints or reviewable limits.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The manifest says this skill is for processing text templates from template files to generate dynamic content, which suggests rendering existing templates with substitutions. Instead, the implementation contains a hardcoded library of software project scaffolds and writes multiple source files such as Python, JavaScript, API, Docker, React, and README templates to disk.

Unsafe Defaults

Medium
Category
Tool Misuse
Content
ports:
      - "8000:8000"
    environment:
      - NODE_ENV=development
    volumes:
      - .:/app
      - /app/node_modules
Confidence
88% confidence
Finding
The generated docker-compose template sets NODE_ENV=development and bind-mounts the working directory, which encourages a development configuration by default. In a skill that scaffolds runnable projects, unsafe defaults matter because users may deploy generated artifacts without hardening them, increasing exposure to debug behavior, weaker operational settings, or accidental source leakage in containerized environments.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The manifest describes the skill as processing text templates with variable substitution for generating dynamic content from template files. In addition to reading and processing templates, the CLI implements an initialization mode that writes new template files to disk, which is a broader file-creation capability not conveyed by the stated description.

Intent-Code Divergence

Low
Confidence
84% confidence
Finding
The module docstring says "Template Tool - Generate code templates" and the CLI parser description says "Code template generator," which indicates code/project scaffolding behavior. That documented intent conflicts with the manifest description of generic text-template processing from template files.

Static analysis

No suspicious patterns detected.