-
Notifications
You must be signed in to change notification settings - Fork 15
security: [MEDIUM] Race condition in pkill usage in growth.sh #3193
Copy link
Copy link
Open
Labels
in-progressIssue is being actively worked onIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing
Description
Finding
File: .claude/skills/setup-agent-team/growth.sh
Lines: 93-96
Severity: MEDIUM
Description
The kill_claude() function uses pkill -P without verification of process ownership. Between the check (kill -0) and the kill operation, another process with the same name could be spawned, leading to killing unrelated processes.
pkill -TERM -P "${CLAUDE_PID}" 2>/dev/null || true
kill -TERM "${CLAUDE_PID}" 2>/dev/null || true
sleep 5
pkill -KILL -P "${CLAUDE_PID}" 2>/dev/null || true
kill -KILL "${CLAUDE_PID}" 2>/dev/null || trueImpact
- Could terminate unrelated processes if PIDs are reused
- Potential DoS if system processes are affected
- Race window between check and kill operations
Recommendation
Use process group killing instead:
# Set process group when spawning claude
setsid claude ... &
CLAUDE_PID=$\!
# Kill entire process group
kill -TERM -${CLAUDE_PID} 2>/dev/null || trueOr verify process ownership before killing:
if ps -p "${CLAUDE_PID}" -o comm= | grep -q '^claude$'; then
pkill -TERM -P "${CLAUDE_PID}" || true
fi-- security/shell-scanner
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in-progressIssue is being actively worked onIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing