T09 · Insecure Skill Coding Practices
- Location
scripts/cleanup-zombie-browsers.sh:343- Finding
Unverified Process-Group Termination Can Kill Unrelated Processes
- Content
View full analysis
/dev/null | tr -d ' ')" 2>/dev/null \ || kill -TERM "$pid" 2>/dev/null \ || { log "PID $pid already gone"; continue; } # Wait for graceful exit waited=0 while (( waited < GRACE_PERIOD_SECONDS )); do if ! kill -0 "$pid" 2>/dev/null; then log "PID $pid and children terminated gracefully" break fi sleep 1 waited=$((waited + 1)) done # SIGKILL if still alive if kill -0 "$pid" 2>/dev/null; then log "PID $pid did not exit after ${GRACE_PERIOD_SECONDS}s, sending SIGKILL" kill -KILL -- "-$(ps -o pgid= -p "$pid" 2>/dev/null | tr -d ' ')" 2>/dev/null \ || kill -KILL "$pid" 2>/dev/null || true fi ``` ### Technical Analysis A negative PID passed to `kill` addresses an entire process group rather than only the validated browser PID. The discovery logic validates one process as a current-user, orphaned OpenClaw browser, but the script does not enumerate or validate every member of that process group before sending SIGTERM or SIGKILL. Process-group membership does not guarantee that every member is a descendant of the selected browser or that every member satisfies the OpenClaw command-line, ownership, orphan-status, and age checks. Consequently, the destructive operation has a broader scope than the documented browser-only safety boundary. The `child_count` calculation does not mitigate this issue. It only counts direct children and is not used to constrain which processes receive the signal. ### Attack Path 1. A qualifying browser process is placed in, or remains part of, a process group that also contains unrelated processes. 2. The ...[truncated 1025 chars]- Remediation
View remediation
