T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Stored in Plaintext Shell Startup Files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37-42
Vulnerability Type: Plaintext sensitive credential storage
Risk Level: MediumVulnerable Code Snippet:
bash export TONGXIAO_API_KEY='your-api-key-here'The documentation then recommends persisting the credential:
bash echo "export TONGXIAO_API_KEY='your-api-key-here'" >> ~/.zshrc source ~/.zshrcTechnical Analysis
The setup instructions recommend writing the Alibaba Cloud IQS API key directly into a shell startup file such as
~/.zshrcor~/.bashrc. This stores the credential as plaintext on disk and automatically exports it into every subsequently launched shell process.Shell configuration files can be exposed through overly broad file permissions, compromised local processes, workstation backups, diagnostic archives, shell configuration synchronization, or accidental publication of dotfiles. Exporting the key also makes it available to child processes through their environment, increasing the number of processes and tools that may access the credential.
The project does not hardcode an actual credential, and exploitation requires a user to follow the documented persistence recommendation with a real API key.
Attack Path
- A user replaces the placeholder with a valid Alibaba Cloud IQS API key and follows the documented command.
- The key is written in plaintext to
~/.zshrcor an equivalent shell startup file. - A local malicious process, unauthorized user with file access, exposed backup, synchronized dotfile repository, or accidentally published configuration obtains the file.
- The attacker extracts the API key from the exported environment-variable declaration.
- The attacker submits authenticated requests to the Alibaba Cloud IQS service using the stolen key.
Impact Assessment
Successful exploitation exposes the user's IQS API credential. An attacker may issue API requests unde ...[truncated 426 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the recommendation to place the API key directly in
~/.zshrc,~/.bashrc, or other routinely synchronized configuration files. - Prefer an operating-system credential manager, dedicated secret-management service, or platform-provided secret injection mechanism.
- If file-based loading is unavoidable, store the key in a dedicated file outside the project and dotfile repositories, restrict its permissions to the owner (for example, mode
0600), and load it only for the process that requires it. - Avoid globally exporting the credential to every child process. Pass it only to the search command or its controlled execution environment.
- Add guidance warning users not to commit, synchronize, log, or include the key in support bundles and backups without suitable protection.
- Document immediate credential revocation and rotation procedures for suspected exposure.
- Remove the recommendation to place the API key directly in
