T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:17
- Finding
- API Key Disclosed Through Terminal Output<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 17–20 **Vulnerability Type**: Credential exposure through insecure diagnostic instructions **Risk Level**: Medium ### Vulnerable Code ```bash echo $EASTMONEY_APIKEY ``` ### Technical Analysis The documented environment-variable check prints the complete `EASTMONEY_APIKEY` value to standard output. Testing whether an environment variable exists does not require disclosing its contents. The secret may consequently be retained in terminal scrollback, CI/CD logs, agent execution transcripts, remote-support recordings, or centralized logging systems. Any party with access to those outputs could recover and reuse the API key. ### Attack Path 1. A user or AI agent follows the documented setup procedure. 2. The shell expands `$EASTMONEY_APIKEY` to its complete secret value. 3. The value is printed to the terminal. 4. Terminal output is retained in scrollback, an agent transcript, a CI log, or another monitoring system. 5. A party with access to that output obtains the key and submits unauthorized requests to the Eastmoney API. ### Impact Assessment Exploitation exposes the privileges associated with the compromised Eastmoney API key. An attacker could consume the victim's API allowance, submit queries under the victim's credentials, and potentially cause service charges, quota exhaustion, or account-level disruption. This issue does not directly grant local operating-system privileges. Its scope is limited to the permissions and resources available through the exposed API credential. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions Replace the secret-revealing command with a presence check that never prints the credential: ```bash if [ -n "${EASTMONEY_APIKEY:-}" ]; then echo "EASTMONEY_APIKEY is set" else echo "EASTMONEY_APIKEY is not set" fi ``` Additional hardening measures should include: - Explicitly instruct users not to print, log, or paste the API key into conversations. - Mask the variable in CI/CD and agent execution platforms. - Redact authentication headers from HTTP debugging and error logs. - Rotate the API key immediately if it has already appeared in retained output. - Use a dedicated secret manager where supported. ]]>
