T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:30
- Finding
- Plaintext credential storage in shell startup files or crontab is recommended<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 30 and 47-51 **Vulnerability Type**: Plaintext sensitive-data exposure **Risk Level**: Medium ### Vulnerable Code ```markdown 本 Skill 不会自动加载任何外部 `.env` 文件。请通过环境变量或直接在 crontab 中设置密钥. ``` The configuration section also recommends persistent shell configuration: ```bash export BAIDU_APPID="你的AppID" export BAIDU_SECRET="你的密钥" export FEISHU_WEBHOOK="你的飞书Webhook地址" ``` ### Technical Analysis The documentation advises users to place the Baidu API secret and Feishu webhook URL directly in `~/.bashrc` or a crontab entry. Both are persistent plaintext configuration locations. A Feishu webhook URL is effectively a bearer credential: anyone who obtains it can generally submit messages to the associated bot. The Baidu translation secret can similarly be abused to consume the account's API quota or incur charges. Environment variables also become available to child processes and may be exposed through diagnostic output, process inspection under applicable operating-system permissions, shell backups, support bundles, or accidentally shared configuration files. Placing credentials directly in a crontab is unnecessary for the declared news-aggregation functionality. Scheduling the aggregator can be legitimate, but embedding secrets in the schedule definition does not follow least-secret-exposure practices. The project does not itself install a cron job, startup service, or other persistence mechanism. Therefore, the reviewed code does not establish a T06 system-persistence vulnerability. The finding concerns insecure credential-storage guidance rather than unauthorized persistence. ### Attack Path 1. A user follows the documented setup and stores `BAIDU_SECRET` and `FEISHU_WEBHOOK` in `~/.bashrc` or directly inside their crontab. 2. Another local process, account with applicable read permissions, backup operator, diagnostic collector, or person receiving a copied configuration file obtains the p ...[truncated 825 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not recommend placing secrets directly in `~/.bashrc` or inline in crontab. - Store credentials in a dedicated file readable only by the owning account, for example with mode `0600`, and load it only in the execution wrapper. - Prefer an operating-system credential facility or secret manager where available. - If cron is used, keep the schedule free of credentials and invoke a restricted wrapper that retrieves secrets at runtime. - Run the scheduled task as an unprivileged, dedicated account with access only to the output and history directories it needs. - Document webhook and API-secret rotation procedures. - Warn users not to print environment variables, commit credential files, or include them in support bundles. - Make `FEISHU_WEBHOOK` optional in metadata as documented, rather than treating it as an unconditional dependency. ]]>
