T09 · Insecure Skill Coding Practices
- Location
SKILL.md:35- Finding
API Key Exposure Through Terminal Output and Conversation History
- Content
View full analysis
"Do you have a Mira API key?" - **Yes** — ask them to provide it, then set it as an environment variable: ```bash export MIRA_KEY="mira_your_key_here" ``` ``` ### Technical Analysis The setup procedure instructs the agent to execute `echo $MIRA_KEY`. This prints the complete API key to command output rather than merely testing whether the variable exists. The exposed value may subsequently be retained in tool-call records, terminal transcripts, diagnostic logs, or other session artifacts. The instructions also direct the agent to ask the user to provide the key and then place it directly in an `export` command. Supplying a credential through an ordinary conversation can store it in chat history, while embedding it in a shell command may expose it through shell history or command logging. The API documentation confirms that this key is subsequently used as a bearer credential in the `Authorization` header. Anyone who obtains the plaintext value can authenticate with the same API authority until the key expires, is disabled, or is rotated. ### Attack Path 1. A user or operator invokes the skill for the first time. 2. The agent follows the setup instructions and executes `echo $MIRA_KEY`. 3. If the variable is populated, its complete value is written to captured command output. 4. If it is not populated, the agent asks the user to provide the key through the conversation and may execute an `export` command containing the plaintext credential. 5. An attacker with access to conversation records, tool output, terminal logs, or shell history retrieves the credential. 6. The attacker sends requests to the OpenJobs AI API using `Authorization: Bearer `. 7. Requests consu ...[truncated 511 chars]- Remediation
View remediation
