T09 · Insecure Skill Coding Practices
- Location
src/autoloop.ts:190- Finding
Shell Command Injection Through Unsanitized Program Configuration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill has a coherent optimization purpose, but it gives agents broad unsandboxed power to run shell commands, edit files, rewrite git history, and manage background processes with weak containment.
Install only in an isolated, disposable repository or container, and only with program.md files and executor commands you fully trust. Avoid sensitive repos or environments with valuable tokens, review setup/run/metric commands before use, and treat the MCP server as capable of starting local background work and terminating processes.
src/autoloop.ts:190Shell Command Injection Through Unsanitized Program Configuration
src/mcp-server.ts:110Arbitrary Shell Execution Through the MCP Executor Argument
src/autoloop.ts:249Unrestricted Path Resolution Allows Access Outside Approved Project Directories
src/mcp-server.ts:181Arbitrary Process Termination Through Untrusted Lock-File PID
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
try {
const stdout = execSync(cmd, {
cwd: opts?.cwd,
env: { ...process.env, ...opts?.env },
timeout: opts?.timeout,
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"],
git reset --hard is a destructive operation that can be abused or accidentally triggered to wipe local modifications and revert repository state. In this skill, it is part of the normal loop behavior, so the concern is not attacker-controlled arguments but unsafe automation that can damage user data when used on the wrong repo or alongside uncommitted work.
return sh("git rev-parse --short HEAD", { cwd }).stdout.trim();
}
function gitResetLast(cwd) {
sh("git reset --hard HEAD~1", { cwd });
}
function gitCommit(file, message, cwd) {
sh(`git add ${file}`, { cwd });
The stop operation reads a PID from .autoloop.lock, calls process.kill() on that PID, and then deletes the lock file. If an attacker can create or modify the lock file, or trick the tool into operating on an arbitrary directory, they can cause termination of unrelated local processes, resulting in denial of service or disruption of other workloads.
The tool schema explicitly exposes an executor string that is passed through to the autoloop process as a command-line argument, enabling users or upstream agents to supply arbitrary shell commands for proposal generation. In the context of an MCP server, this is dangerous because tool callers may be less trusted than the local host, and the skill is intentionally providing a path to local command execution without validation or restriction.
fast-uri 3.1.0 has multiple advisories covering URI parsing confusion and SSRF-relevant edge cases. As a transitive dependency of ajv used by the MCP SDK, this becomes more concerning in a skill that may process untrusted schemas, URLs, or remote endpoints during autonomous loops, because parser discrepancies can undermine allowlists and network boundary assumptions.
hono 4.12.12 is flagged with numerous advisories, including routing, cookie, and injection-related issues. Since @modelcontextprotocol/sdk depends on Hono and this skill exposes an MCP server binary, the web/server context makes these issues more relevant than in a purely local library, even though the lockfile alone cannot prove each vulnerable feature is exercised.
ip-address 10.1.0 carries advisories for address parsing ambiguity and XSS in HTML-emitting methods. Here it is a transitive dependency of express-rate-limit; the parsing ambiguity is the more relevant risk because IP normalization mistakes can affect rate limiting or trust decisions if the skill is network-exposed, while the XSS issue is less likely unless HTML output methods are used.
The shell helper passes the full process.env into every spawned command, so any setup script, experiment command, metric extractor, or executor can read API keys, tokens, and other secrets from the environment. In this skill's context, that risk is amplified because these commands are partially controlled by program.md and by an external model executor, making credential exposure a realistic consequence of normal use.
try {
const stdout = execSync(cmd, {
cwd: opts?.cwd,
env: { ...process.env, ...opts?.env },
timeout: opts?.timeout,
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"],
git reset --hard HEAD~1 is a destructive state-changing command that irreversibly drops the most recent commit and resets the working tree. In an autonomous agent loop, especially one driven by model output and experiment results, this can be abused or triggered unexpectedly to destroy user work, and it compounds the risk from automatic branch switching and file modification.
}
function gitResetLast(cwd?: string): void {
sh("git reset --hard HEAD~1", { cwd });
}
function gitCommit(file: string, message: string, cwd?: string): string {
The tool schema explicitly exposes an executor string that is later passed through to the autoloop process, enabling callers to choose arbitrary local commands to run as part of the optimization loop. In an MCP server context, this meaningfully expands the skill from 'optimization loop' into general subprocess execution, which can be abused for arbitrary code execution, data exfiltration, or persistence on the host.
The README explicitly describes autonomous file edits, git branch creation, commits/reverts, experiment execution, and writing result files, but it does not clearly warn users that running the tool will modify their repository and execute commands locally. In a code-agent context, that omission is security-relevant because users may treat the tool as advisory when it is actually state-changing and can affect source code, history, and local artifacts.
The README instructs users to supply an executor command and gives examples of external CLI tools, but it does not prominently warn that the program will invoke arbitrary subprocesses on the user's machine. Because the executor is command-based and the tool is autonomous, misuse or misunderstanding could lead to unreviewed command execution, exposure of local data to external model CLIs, or execution in sensitive environments.
The skill advertises and depends on code-execution-adjacent capabilities (node, git, shell-based executors, and environment access) but does not declare any explicit tool scope or permission boundary. In an autonomous optimization loop that edits files, runs commands, and commits changes, missing scope declarations increase the chance that a host agent grants broader execution or environment access than the user expects.
The description uses broad activation language like 'Best for any task with a numeric metric' and presents a generic autonomous loop without clear limits on repository type, command safety, or execution boundaries. That ambiguity can cause an agent or user to apply the skill to sensitive projects or unsafe workflows where autonomous editing, experimentation, and command execution materially increase risk.
The markdown describes a tool that creates git branches, proposes code changes, runs setup and experiment shell commands, measures results, and commits or reverts autonomously, but it does not prominently warn users about those side effects. Because program.md can contain commands such as npm install and arbitrary run/extract steps, a user may trigger code execution and repository mutation without understanding the security implications.
The tool performs git reset --hard HEAD~1 automatically to discard failed or worse experiments with no user confirmation or safety interlock. In an autonomous loop that edits files and commits repeatedly, this can destroy uncommitted work or unexpectedly rewrite the working tree, making accidental data loss likely if run in the wrong repository or with concurrent changes.
runExperiment executes config.runCommand, and later metric extraction executes config.metric.extract, both sourced from a parsed program.md file and passed to bash -c. That means anyone controlling the program spec can run arbitrary shell commands on the host, which is especially dangerous because this skill is explicitly autonomous and repeatedly executes these commands during optimization.
The executor CLI value is interpolated directly into a shell command (${executor} < "${promptFile}") and executed, enabling arbitrary command execution if the parameter is malicious or mistakenly unsafe. Because this tool is designed to call external agent CLIs, the skill context increases risk: users are likely to provide dynamic commands, and the shell wrapper allows chaining, redirection, and command substitution.
The server launches a detached background subprocess with detached: true, stdio: "ignore", and unref() without any interactive confirmation, making it easy for an MCP client or agent workflow to start persistent local activity silently. In an agent-tooling context, that increases risk because a model can trigger long-running execution on the user's machine with limited visibility or immediate control.
The stop action can terminate a process and remove its lock file immediately, without any confirmation or display of the PID or target details. That creates a safety hazard in agent-driven environments because an automated caller can disrupt active work or kill the wrong process with minimal friction.
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.
return `Error: ${err.message}`;
}
}
function toolAutoloopList(args) {
const loops = listRecentLoops(args.limit || 10);
if (loops.length === 0) return "No recent loops found.";
let output = `Recent autoloop runs (${loops.length}):
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.
return `Error: ${err.message}`;
}
}
function toolAutoloopList(args) {
const loops = listRecentLoops(args.limit || 10);
if (loops.length === 0) return "No recent loops found.";
let output = `Recent autoloop runs (${loops.length}):
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.
return `Error: ${err.message}`;
}
}
function toolAutoloopList(args) {
const loops = listRecentLoops(args.limit || 10);
if (loops.length === 0) return "No recent loops found.";
let output = `Recent autoloop runs (${loops.length}):
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.
return `Error: ${err.message}`;
}
}
function toolAutoloopList(args) {
const loops = listRecentLoops(args.limit || 10);
if (loops.length === 0) return "No recent loops found.";
let output = `Recent autoloop runs (${loops.length}):
This code executes config.runCommand, config.metric.extract, config.setup, and the user-supplied executor through bash -c/shell redirection, with values sourced from program.md or CLI input. That gives the program spec and executor full arbitrary command execution on the host, which is highly dangerous in an autonomous loop because the content being optimized is treated as instructions and runs repeatedly with inherited environment variables.