T09 · Insecure Skill Coding Practices
- Location
SKILL.md:124- Finding
Overbroad Cleanup Command Can Terminate Unrelated Development Servers
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 124-129
Vulnerability Type: Overbroad process termination
Risk Level: MediumVulnerable code:
markdown - Dev server: `kill` the background task id, or `ps aux | grep -E "next.dev|vite|bun.*dev" | grep -v grep | awk '{print $2}' | xargs -r kill` - Any other `run_in_background: true` tasks this skill started - Do this proactively at end-of-flow; don't wait for the user to ask. If the user is actively iterating (asking for follow-up edits in the same session), keep the server running — they'll want the preview. The trigger for cleanup is session boundary, not every tool call.Technical Analysis
The fallback cleanup command searches the entire process list for generic command-line patterns associated with Next.js, Vite, and Bun development servers. It does not verify that matched processes were launched by this skill, belong to the active worktree, or correspond to the background task created during the current session.
Consequently, the command violates process ownership boundaries at the application level. Any user-owned process whose command line matches
next.dev,vite, orbun.*devcan be selected and terminated. The pipeline also has a time-of-check/time-of-use weakness because process IDs are collected and later passed tokillwithout validating their identity immediately before termination.Attack Path
- A user starts an unrelated Next.js, Vite, or Bun development server.
- The implementation skill starts another development server for its worktree.
- The implementation flow reaches its cleanup stage.
- Instead of terminating the recorded background task ID, the documented fallback command is executed.
ps auxreturns both the skill-managed server and unrelated matching processes.- The generic regular expression selects all matching process IDs.
xargs -r killsends a termination signal to every selecte ...[truncated 739 chars]
- Remediation
View remediation
Remediation Suggestions
- Record the exact background task identifier and operating-system PID when the development server is started.
- Terminate only that recorded task or its verified process group.
- Remove the global
ps aux | grep ... | xargs killfallback. - If PID-based recovery is necessary, store a PID file inside the isolated worktree and validate all of the following before sending a signal:
- The PID is still active.
- The process owner matches the current user.
- The process start time matches the recorded process.
- The process working directory resolves to the current worktree.
- The command line matches the server command launched by this skill.
- Prefer graceful termination with a bounded timeout before escalating to a stronger signal.
- Report cleanup failure to the user rather than terminating processes that cannot be conclusively attributed to the current skill run.
