T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:47
- Finding
- Credential values are exposed through diagnostic commands<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 47–50 **Vulnerability Type**: Credential disclosure through command output **Risk Level**: High ### Vulnerable Code ```bash # Check environment variables echo $XT_ACCESS_KEY # Or check the local file cat ~/.xt-exchange/credentials.json 2>/dev/null ``` ### Technical Analysis The documented credential checks print sensitive authentication material rather than merely checking whether it exists. The first command exposes the XT.COM access key, while the second can expose the complete credential file, including both the access key and secret key. When an AI agent executes these commands, their output may be retained in the agent transcript, terminal logs, debugging records, observability systems, or chat history. Credential presence can be verified without reading or displaying the values. Access to `~/.xt-exchange/credentials.json` is otherwise consistent with authenticated exchange functionality. The vulnerability is specifically the instruction to print its contents, which exceeds the minimum access necessary for checking credential availability. ### Attack Path 1. A user requests an authenticated account or trading operation. 2. The agent follows the Skill instructions and checks credential availability. 3. The agent executes `echo $XT_ACCESS_KEY` or `cat ~/.xt-exchange/credentials.json`. 4. The access key or complete credential pair appears in command output. 5. The output is captured in an agent transcript, terminal log, or monitoring system. 6. A party with access to those records obtains the credentials. 7. The exposed credentials are used against XT.COM within the API key's configured permissions. ### Impact Assessment Exposure of both the access key and secret key may allow an attacker to generate authenticated XT.COM requests. Depending on the API key permissions and exchange-side restrictions, this may expose account balances and order history or permit order placement, c ...[truncated 224 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Replace value-disclosing commands with tests that reveal only whether credentials are available: ```bash if test -n "$XT_ACCESS_KEY" && test -n "$XT_SECRET_KEY"; then echo "Environment credentials are configured." fi if test -r "$HOME/.xt-exchange/credentials.json"; then echo "A readable credential file is present." fi ``` Additional hardening measures: 1. Explicitly instruct the agent never to print, quote, summarize, or paste credential values. 2. Require restrictive credential-file permissions, such as mode `0600`. 3. Validate the credential file structurally inside the Python scripts without returning its contents. 4. Redact known credential fields from logs and agent tool output. 5. Recommend API keys with only the permissions necessary for intended operations. 6. Recommend IP allowlisting and disabling withdrawal permissions unless withdrawals are explicitly required. ]]>
