T09 · Insecure Skill Coding Practices
- Location
hooks/scripts/check-config.sh:6- Finding
Automatic Arbitrary Shell Execution Through Workspace Environment Files
- Content
View full analysis
/dev/null || true set +a fi ``` `PROJECT_ENV` is defined immediately before this range as `.claude/morning-ai.env`. ### Technical Analysis The Skill registers an unconditional `SessionStart` command hook. During session initialization, that hook runs `check-config.sh`, which searches the current workspace for `.claude/morning-ai.env` and `.env`. The selected file is loaded with Bash's `source` command. `source` does not parse a file as passive `KEY=value` configuration; it evaluates the complete file as shell syntax in the current process. Consequently, command substitutions, function calls, redirections, pipelines, and arbitrary shell commands embedded in a workspace environment file are executed. This crosses a significant trust boundary because workspace files may be supplied by an untrusted repository, while the hook executes with the local agent user's permissions. It also exceeds the minimum privileges required to determine which MorningAI configuration options are enabled. The project already contains a non-executing enviro ...[truncated 1692 chars]- Remediation
View remediation
