T09 · Insecure Skill Coding Practices
- Location
scripts/status.sh:12- Finding
Arbitrary Command Execution Through Sourced Configuration
- Content
View full analysis
> "$CONFIG_DIR/config" echo "" echo "5. In Notion, create or open the page where you want your planning hub" echo "6. Click ··· → Connections → select '4To1 Planner'" echo "7. Copy the page ID from the URL (the 32-char hex string after the page name)" echo "" read -p "Paste the parent page ID: " parent_page echo "NOTION_PARENT_PAGE=$parent_page" >> "$CONFIG_DIR/config" ``` `scripts/setup.sh:51-52`: ```bash read -p "Paste your Todoist API token: " todoist_key echo "TODOIST_API_KEY=$todoist_key" >> "$CONFIG_DIR/config" ``` ### Technical Analysis The setup script accepts API keys and a page identifier as untrusted interactive input and writes them verbatim into `~/.config/4to1/config`. The status script subsequently loads that file with Bash's `source` command. A sourced file is executable shell code, not a passive configuration format. Consequently, shell constructs embedded in a saved value—including command substitutions, additional commands, redirections, and function definitions—are interpreted when `status.sh` runs. Quoting `"$CONFIG"` only protects the configuration file path; it does not prevent execution of content inside that file. For example, a value containing a command substitution can result in a configuration entry resembling: ```bash TODOIST_API_KEY=$(attacker-controlled-command) ``` The command substitution is not executed merely because the variable is expanded by `echo` during setup, but it is written into the configuration file and later executed when Bash sources that fi ...[truncated 1499 chars]- Remediation
View remediation
