T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Persistent Plaintext Storage and Terminal Disclosure of API Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:37-41,SKILL.md:157-161,README.md:25-29,README.md:134-138, andreferences/config-examples.md:128-136
Vulnerability Type: Plaintext credential storage and sensitive information exposure
Risk Level: MediumVulnerable Code
SKILL.md:37-41:bash export ERNIE_API_KEY="bce-v3/ALTAK-your-key-here" source ~/.zshrc # or source ~/.bashrcSKILL.md:157-161:bash echo $ERNIE_API_KEYREADME.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_KEYreferences/config-examples.md:128-136:bash export ERNIE_API_KEY="bce-v3/ALTAK-your-key-here"Then reload:
bash source ~/.bashrc # or source ~/.zshrcTechnical Analysis
The documentation directs users to place the Qianfan API key directly in a shell startup file such as
~/.bashrcor~/.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
- A user follows the integration instructions and stores a valid Qianfan API key in a shell startup file.
- The user later runs
echo $ERNIE_API_KEYwhile troubleshooting. - An attacker or unintended observer obtains the credential ...[truncated 973 chars]
- Remediation
View remediation
Remediation Suggestions
-
Recommend an operating-system credential manager, dedicated secret manager, or platform-supported credential facility instead of placing the key directly in shell startup files.
-
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. -
Replace
echo $ERNIE_API_KEYwith 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 -
If partial identification is necessary, display only a small redacted prefix or fingerprint and never print the complete credential.
-
Warn users not to include secrets in screenshots, issue reports, support transcripts, CI logs, or recorded terminal sessions.
-
Advise immediate revocation and rotation if a key has already appeared in terminal captures or other retained output.
-
Preserve the existing guidance against committing credentials to version control, and supplement it with secret-scanning and pre-commit checks.
-
