T09 · Insecure Skill Coding Practices
- Location
scripts/team-cleanup.sh:172- Finding
Broad Process Matching Can Terminate Unrelated Claude Sessions
- Content
View full analysis
/dev/null; then return 0 else return 1 fi } ``` ```bash echo "Terminating Claude Code processes..." if pkill -f "claude.*pty"; then echo -e "${GREEN}✅ Processes terminated${NC}" else echo -e "${YELLOW}⚠️ No processes found${NC}" fi ``` ### Technical Analysis The cleanup script uses `pgrep -f` and `pkill -f` with the regular expression `claude.*pty`. The `-f` option matches against each process's complete command line rather than a precisely tracked process identifier. This pattern is not tied to the specific agent-team session managed by the Skill. Consequently, it may select every same-user process whose command line contains `claude` followed later by `pty`, including unrelated Claude sessions. The script also supports `--force --yes`, allowing termination to proceed without an interactive confirmation. This is an unsafe process-management practice rather than evidence of deliberately malicious code. The command normally remains constrained by the invoking user's operating-system permissions and does not itself provide privilege escalation. ### Attack Path 1. A user has multiple Claude PTY sessions running, including sessions unrelated to this Skill. 2. The user or an automation process invokes: ```bash ./scripts/team-cleanup.sh --force --yes ``` 3. `AUTO_YES=true` bypasses the force-shutdown confirmation. 4. `pkill -f "claude.*pty"` searches all processes visible and terminable by the invoking user. 5. Every matching process is sent the default termination signal, rather than only the session associated with the current team. 6. Unrelated sessions may terminate and lose in-progress, ...[truncated 787 chars]- Remediation
View remediation
