T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/run_monitor.sh:9
- Finding
- Execution of Unverified External Monitoring Scripts<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/run_monitor.sh:9-24` - `scripts/check_updates.sh:9-21` **Vulnerability Type**: Execution of mutable code outside the audited Skill package **Risk Level**: High ### Vulnerable Code `scripts/run_monitor.sh`: ```bash MONITOR_DIR="/root/monitoring/securities" if [ ! -d "${MONITOR_DIR}" ]; then exit 1 fi cd "${MONITOR_DIR}/scripts" && bash crawl_all.sh ``` `scripts/check_updates.sh`: ```bash MONITOR_DIR="/root/monitoring/securities" if [ ! -d "${MONITOR_DIR}" ]; then exit 1 fi cd "${MONITOR_DIR}/scripts" && bash check_notifications.sh ``` ### Technical Analysis The packaged scripts delegate their core functionality to shell scripts stored outside the audited project. They verify only that `/root/monitoring/securities` is a directory; they do not verify: - The ownership or permissions of the directory and target scripts. - Whether the target is a symbolic link. - The identity or cryptographic integrity of the scripts. - Whether the scripts correspond to a reviewed release. - Whether the invoking process has unnecessary elevated privileges. Consequently, the effective implementation of the Skill is not present in the reviewed artifact and can change independently after review. Invoking `bash` on these mutable files grants them all privileges available to the Skill process. The documented cron configuration further increases exposure because it repeatedly invokes `/root/monitoring/securities/scripts/crawl_all.sh`. Although scheduled monitoring is relevant to the declared functionality and no automatic cron installation is included in this package, scheduling an unverified external script turns any later modification into recurring execution. ### Attack Path 1. An attacker or compromised administrative process obtains write access to `/root/monitoring/securities/scripts`, one of its target scripts, or a component involved in deploying that external directory. 2. The attacker replaces `cr ...[truncated 1041 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bundle `crawl_all.sh`, `check_notifications.sh`, and their dependencies inside the reviewed Skill package. 2. Resolve executable paths relative to the trusted script directory rather than a mutable absolute installation: ```bash SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)" exec bash "${SCRIPT_DIR}/crawl_all.sh" ``` 3. Before execution, reject symbolic links and verify that each target is a regular file owned by the expected account with no group or world write permissions. 4. If external deployment is unavoidable, pin and verify a cryptographic digest or signed manifest before every execution. 5. Run the monitoring process and its scheduled task as a dedicated, unprivileged service account rather than root. 6. Limit filesystem access to a dedicated data directory and grant only the network access needed for the declared regulatory sites and scraping service. 7. Require explicit user confirmation before creating a schedule, document how to remove it, and point the schedule only to immutable, integrity-checked code. ]]>
