T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:37
- Finding
- Persistent Plaintext Storage and Terminal Disclosure of API Credentials## Vulnerability Details **File Location**: `SKILL.md:37-41`, `SKILL.md:157-161`, `README.md:25-29`, `README.md:134-138`, and `references/config-examples.md:128-136` **Vulnerability Type**: Plaintext credential storage and sensitive information exposure **Risk Level**: Medium ### Vulnerable Code `SKILL.md:37-41`: ```bash export ERNIE_API_KEY="bce-v3/ALTAK-your-key-here" source ~/.zshrc # or source ~/.bashrc ``` `SKILL.md:157-161`: ```bash echo $ERNIE_API_KEY ``` `README.md:25-29`: ```bash export ERNIE_API_KEY="bce-v3/ALTAK-your-key-here" ``` `README.md:134-138`: ```bash # Verify API key echo $ERNIE_API_KEY ``` `references/config-examples.md:128-136`: ```bash export ERNIE_API_KEY="bce-v3/ALTAK-your-key-here" ``` Then reload: ```bash source ~/.bashrc # or source ~/.zshrc ``` ### Technical Analysis The documentation directs users to place the Qianfan API key directly in a shell startup file such as `~/.bashrc` or `~/.zshrc`. This retains the credential in plaintext across sessions. Any process or account capable of reading the user's profile can recover the complete credential. The troubleshooting instructions additionally use `echo $ERNIE_API_KEY`, which prints the complete secret to the terminal. The value may consequently be exposed through terminal recordings, scrollback, screenshots, copied support transcripts, CI output, remote-session logging, or other command-output capture mechanisms. Although the examples use an obvious placeholder rather than a real embedded key, users are explicitly expected to replace it with a live credential. The vulnerable behavior therefore occurs when the documented procedure is followed. ### Attack Path 1. A user follows the integration instructions and stores a valid Qianfan API key in a shell startup file. 2. The user later runs `echo $ERNIE_API_KEY` while troubleshooting. 3. An attacker or unintended observer obtains the credential ...[truncated 973 chars]
- Remediation
- ## Remediation Suggestions 1. Recommend an operating-system credential manager, dedicated secret manager, or platform-supported credential facility instead of placing the key directly in shell startup files. 2. If file-based storage is unavoidable, use a dedicated secrets file outside the repository, restrict it to the owning user with mode `0600`, and load it only for the process that requires the credential. 3. Replace `echo $ERNIE_API_KEY` with a presence check that does not reveal the value: ```bash if [ -n "${ERNIE_API_KEY:-}" ]; then printf '%s\n' "ERNIE_API_KEY is set" else printf '%s\n' "ERNIE_API_KEY is not set" fi ``` 4. If partial identification is necessary, display only a small redacted prefix or fingerprint and never print the complete credential. 5. Warn users not to include secrets in screenshots, issue reports, support transcripts, CI logs, or recorded terminal sessions. 6. Advise immediate revocation and rotation if a key has already appeared in terminal captures or other retained output. 7. Preserve the existing guidance against committing credentials to version control, and supplement it with secret-scanning and pre-commit checks.
