T09 · Insecure Skill Coding Practices
- Location
scripts/scan_ai_tools.sh:6- Finding
Unsafe Shell Initialization and PATH-Based Tool Execution
- Content
View full analysis
/dev/null; then echo "✅ $name ($cmd) - 已安装" # 测试可用性 - 直接运行帮助命令 if "$cmd" --help &> /dev/null || "$cmd" -h &> /dev/null || "$cmd" --version &> /dev/null || "$cmd" -v &> /dev/null; then ``` The skill documentation explicitly requires this behavior: ```bash source ~/.zshrc command -v gemini command -v claude command -v cursor-agent ``` ### Technical Analysis The scanner sources the user's interactive `.zshrc` file in its current process. Sourcing a shell configuration does not merely import environment variables: every shell command, function definition, alias, command substitution, and external program referenced by the file may execute. After loading the file, the script trusts the resulting `PATH` and invokes executables by short names. Although the tool names themselves are fixed, the executable selected for each name is controlled by `PATH`. A malicious or compromised shell configuration can therefore prepend an attacker-controlled directory containing a forged `gemini`, `claude`, or `cursor-agent` executable. Redirecting output to `/dev/null` does not provide isolation and does not prevent the resolved program from modifying ...[truncated 1261 chars]- Remediation
View remediation
