T09 · Insecure Skill Coding Practices
- Location
SKILL.md:124- Finding
API Key Solicitation and Persistent Plaintext Storage
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 124 and 137–138
Vulnerability Type: Plaintext secret exposure and insecure credential persistence
Risk Level: HighVulnerable Snippet
bash setx ZXT_API_KEY <apiKey> export ZXT_API_KEY=<apiKey>The instructions additionally direct the agent to append the following assignment to the user's
~/.bashrcor~/.zshrc:bash export ZXT_API_KEY=<apiKey>They also instruct the user to send the copied API key to the agent.
Technical Analysis
The Skill requires an API key for its legitimate invoice-verification service. However, the documented setup procedure asks the user to disclose the key through the conversation and directs the agent to persist it in plaintext.
On Windows,
setxplaces the credential in a persistent user-level environment variable. On macOS and Linux, appending anexportstatement to a shell initialization file stores the key directly in a plaintext profile. These mechanisms expose the credential more broadly and for longer than necessary.The implementation already supports the
--api-keyargument and a session environment variable, so modifying persistent shell configuration is not required for the declared functionality. A session-scoped variable, hidden prompt, protected configuration file, or operating-system credential manager would provide the required authentication with less exposure.Attack Path
- The Skill asks the user to send an API key through the agent conversation.
- The key may consequently be retained in conversation logs or agent execution records.
- The agent writes the key to a persistent user environment variable or plaintext shell initialization file.
- Malware, another process running under the user account, a profile backup, a diagnostic bundle, or a party with access to conversation history retrieves the credential.
- The attacker uses the recovere ...[truncated 816 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not instruct users to transmit API keys through ordinary conversation messages.
- Accept credentials through a hidden interactive prompt, protected secret-injection mechanism, or operating-system credential manager.
- Use session-scoped environment variables by default and avoid
setxor modifications to.bashrcand.zshrc. - If persistence is explicitly requested, obtain informed user consent and use Windows Credential Manager, macOS Keychain, or an appropriate Linux secret service.
- Avoid passing keys through command-line arguments where practical because command lines may be exposed through process listings or shell history.
- Document how users can revoke and rotate the key and remove any previously persisted plaintext values.
- Ensure logs and error messages redact API keys.
