T09 · Insecure Skill Coding Practices
- Location
SKILL.md:296- Finding
IMA API Credentials Stored in Plaintext Without Restrictive Permissions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 296–301
Vulnerability Type: Plaintext sensitive-data storage with unspecified filesystem permissions
Risk Level: MediumVulnerable Code
bash # Create config directory mkdir -p ~/.config/ima echo "your_client_id" > ~/.config/ima/client_id echo "your_api_key" > ~/.config/ima/api_keyThe skill subsequently directs the agent to load credentials from these files:
markdown 3. Load credentials from `~/.config/ima/` or environment variables `IMA_OPENAPI_CLIENTID` / `IMA_OPENAPI_APIKEY`.Technical Analysis
The documented setup stores an IMA client identifier and API key as plaintext files. It neither creates the configuration directory with owner-only permissions nor explicitly restricts the credential files to the owner.
The effective permissions therefore depend on the user's current
umaskand any pre-existing permissions on~/.config/ima. In an environment with permissive permissions, another local user or compromised process may be able to read the API key. Writing a literal key through a shell command may also leave the secret in shell history.This is a credential-handling weakness rather than evidence of deliberate exfiltration. The reviewed API example sends credentials only to the declared official HTTPS endpoint at
ima.qq.com.Attack Path
- A user follows the setup instructions and substitutes a real IMA API key into the
echocommand. - The shell creates
~/.config/ima/api_keyusing permissions derived from the currentumask, or overwrites a file whose surrounding directory has insufficiently restrictive permissions. - A malicious local user or process reads the plaintext credential file.
- The attacker submits the stolen credential to the IMA API.
- The attacker gains whatever knowledge-base access and API capabilities are authorized for that key.
Successful exploitation requires local filesystem access through another account, process ...[truncated 556 chars]
- A user follows the setup instructions and substitutes a real IMA API key into the
- Remediation
View remediation
Remediation Suggestions
Create the configuration directory and credential files with explicit owner-only permissions:
bash install -d -m 700 ~/.config/ima umask 077 printf '%s\n' "$IMA_OPENAPI_CLIENTID" > ~/.config/ima/client_id printf '%s\n' "$IMA_OPENAPI_APIKEY" > ~/.config/ima/api_key chmod 600 ~/.config/ima/client_id ~/.config/ima/api_keyAdditional hardening measures:
- Prefer an operating-system credential store or deployment secret manager over plaintext files.
- Prompt for secrets without echoing them rather than placing literal API keys in command lines.
- Do not include real credentials in shell history, logs, examples, source control, or backups.
- Document key rotation and immediate revocation procedures for suspected disclosure.
- Apply least-privilege scopes and expiration limits to API credentials where supported.
- Validate existing directory ownership before loading credentials and reject files writable by other users.
- Keep HTTPS certificate verification enabled for all IMA API requests.
