T09 · Insecure Skill Coding Practices
- Location
scripts/install.sh:5- Finding
Unescaped Script Path Allows Persistent Cron Command Injection
- Content
View full analysis
/dev/null | grep -v "$CRON_MARKER"; echo "$CRON_LINE") | crontab - ``` ### Technical Analysis The installer obtains its directory dynamically and inserts the resulting `CHECK_SCRIPT` path directly into a crontab command without quoting or validating it. Although the shell variable is quoted while constructing `CRON_LINE`, those quotes do not become literal quoting in the generated crontab entry. Cron later passes the command portion to a shell. Consequently, spaces and shell metacharacters in the installation path can change how the command is parsed. Cron also assigns special meaning to percent characters, which can further alter command execution unless correctly escaped. The scheduled task itself is consistent with the Skill's declared watchdog functionality and runs only as the user who invokes `crontab`; therefore, the use of cron is not independently an unauthorized persistence mechanism. The vulnerability is that an attacker-controlled installation path can transform this legitimate recurring task into persistent arbitrary command execution. ### Attack Path 1. An attacker causes the Skill package to be installed or extracted under a directory name containing shell-significant characters, spaces, or cron-special characters. 2. The victim executes `scripts/install.sh`. 3. The installer embeds the unescaped absolute path into `CRON_LINE`. 4. The malformed command is written ...[truncated 912 chars]- Remediation
View remediation
