T09 · Insecure Skill Coding Practices
- Location
SKILL.md:27- Finding
Plaintext API Credential Storage in Shell Startup Files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 27–31
Vulnerability Type: Plaintext sensitive credential storage
Risk Level: MediumVulnerable code:
bash export IMA_OPENAPI_CLIENTID="your_client_id" export IMA_OPENAPI_APIKEY="your_api_key"The adjacent setup instruction recommends placing these export statements directly in
~/.zshrcor~/.bashrcso that the credentials persist across terminal sessions.Technical Analysis
The API key grants access to operations involving private IMA notes. Persisting it as plaintext in a shell startup file unnecessarily increases its exposure period and the number of mechanisms through which it may be disclosed.
Shell profiles may be accessible to malware running under the same user account, local users with sufficient file permissions, compromised development tools, backup systems, diagnostic archives, or accidental configuration-file sharing. Environment variables exported from these files may also propagate to child processes, increasing the number of processes that can potentially access the secret.
Although the displayed values are placeholders rather than hardcoded live credentials, the documented setup procedure directs users to replace them with real credentials and store those credentials persistently in plaintext.
Attack Path
- A user follows the setup instructions and writes a valid client ID and API key into
~/.zshrcor~/.bashrc. - An attacker gains the ability to read files owned by that user, such as through same-account malware, a compromised editor extension, an exposed backup, or overly permissive file permissions.
- The attacker reads the shell startup file and extracts
IMA_OPENAPI_CLIENTIDandIMA_OPENAPI_APIKEY. - The attacker submits authenticated requests to the documented IMA endpoint at
https://ima.qq.com/openapi/note/v1. - Subject to the permissions associated with the stolen credentials, the attacke ...[truncated 793 chars]
- A user follows the setup instructions and writes a valid client ID and API key into
- Remediation
View remediation
Remediation Suggestions
- Do not recommend storing API credentials directly in
~/.zshrc,~/.bashrc, or other routinely accessed configuration files. - Store credentials in an operating-system credential manager, such as macOS Keychain, Windows Credential Manager, or a Linux secret service.
- For automated environments, use the platform's dedicated secret-management facility and inject credentials only into the process that needs them.
- If a secret file is unavoidable, keep it outside the project directory, restrict it to the owning user with permissions equivalent to
0600, and load it only when required. - Avoid passing secrets through command-line arguments or logging them in command output, debugging traces, or error messages.
- Document credential revocation and rotation procedures, including immediate rotation following suspected local compromise.
- Prefer short-lived or narrowly scoped credentials if the IMA service supports them.
- Retain the existing credential-presence check, but supplement it with guidance that environment variables are an injection mechanism rather than a secure long-term storage mechanism.
- Do not recommend storing API credentials directly in
