T09 · Insecure Skill Coding Practices
- Location
scripts/export.py:421- Finding
Untrusted Skill Metadata Can Inject Python Code into the Generated Service
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill has a coherent exporter purpose, but its generated service can be compromised by malicious source-skill metadata and it can delete source scripts when source and output paths overlap.
Review this skill before installing. Use it only on skills you trust, choose an output directory outside the source skill directory, inspect generated api.py before running or deploying it, avoid adding production API keys until the generated code is reviewed, and pin dependencies for production builds.
scripts/export.py:421Untrusted Skill Metadata Can Inject Python Code into the Generated Service
scripts/export.py:409Overlapping Source and Output Paths Can Cause Recursive Data Deletion
scripts/export.py:138Generated Deployments Use Unpinned Third-Party Dependencies
Referenced artifact was not completely inspected
- `SKILL.md` with valid frontmatter
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
ports:
- "{port}:{port}"
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:{port}/health"]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
ports:
- "{port}:{port}"
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:{port}/health"]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
ports:
- "{port}:{port}"
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:{port}/health"]
The exporter reads the source skill's real .env file and extracts variable names from it. While it does not copy values, touching a live secret-bearing file increases secret-handling risk and can normalize operating on plaintext credentials from untrusted skill directories; in adversarial contexts this also lets a crafted skill influence generated secret documentation via its local .env.
import_matches = re.findall(r'^(?:from|import)\s+(\w+)', content, re.MULTILINE)
python_imports.update(import_matches)
# Also check .env file if exists
env_file = skill_path / ".env"
if env_file.exists():
for line in env_file.read_text().splitlines():
This line is part of the same behavior that loads a source skill's .env file if present. Even though only keys are added to output, scanning secret files in untrusted input expands the attack surface and may unintentionally disclose sensitive variable naming conventions or ingest attacker-controlled content into generated files.
python_imports.update(import_matches)
# Also check .env file if exists
env_file = skill_path / ".env"
if env_file.exists():
for line in env_file.read_text().splitlines():
if "=" in line and not line.startswith("#"):
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
print(f"\n✅ Export complete: {output_path}")
print(f"\nNext steps:")
print(f" 1. cd {output_path}")
print(f" 2. cp .env.example .env && edit .env")
print(f" 3. docker-compose up --build")
if target == "railway":
print(f" 4. railway up")
The skill describes capabilities that imply broad file, shell, environment, and possible network access, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates a least-privilege violation: an agent may grant or infer more capability than users expect, increasing the chance of unsafe file operations, command execution, or data exposure during export and deployment workflows.
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.
---
name: skill-exporter
description: Export Clawdbot skills as standalone, deployable microservices. Use when you want to dockerize a skill, deploy it to Railway or Fly.io, or create an independent API service. Generates Dockerfile, FastAPI wrapper, requirements.txt, deployment configs, and optional LLM client integration.
license: MIT
compatibility: Requires python3. Works with any AgentSkills-compatible agent.
metadata:
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
for dep in deps:
apt_packages.append(dep)
return f"RUN apt-get update && apt-get install -y --no-install-recommends \\\n {' '.join(apt_packages)} \\\n && rm -rf /var/lib/apt/lists/*"
def export_skill(
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
for dep in deps:
apt_packages.append(dep)
return f"RUN apt-get update && apt-get install -y --no-install-recommends \\\n {' '.join(apt_packages)} \\\n && rm -rf /var/lib/apt/lists/*"
def export_skill(
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
for dep in deps:
apt_packages.append(dep)
return f"RUN apt-get update && apt-get install -y --no-install-recommends \\\n {' '.join(apt_packages)} \\\n && rm -rf /var/lib/apt/lists/*"
def export_skill(
The Dockerfile RUN line concatenates detected dependency names directly into a shell command using && chaining. Because dependency names originate from scanning untrusted skill script content and are not validated against a strict allowlist at the sink, a future expansion of detection logic or malformed dep token could turn this into command injection in generated build artifacts.
for dep in deps:
apt_packages.append(dep)
return f"RUN apt-get update && apt-get install -y --no-install-recommends \\\n {' '.join(apt_packages)} \\\n && rm -rf /var/lib/apt/lists/*"
def export_skill(
No suspicious patterns detected.