T09 · Insecure Skill Coding Practices
- Location
SKILL.md:15- Finding
API Credential Disclosure Through Shell Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 15-22
Vulnerability Type: API credential exposure through command output
Risk Level: HighVulnerable Code Snippet:
markdown ## Authentication The API requires an API Key in the `Authorization` header. Resolve the key in this order: 1. Check environment variable `SUPERX_API_KEY` — use it silently if set 2. If not set, ask the user for their API key before making any request To check if the env var exists, run: `echo $SUPERX_API_KEY`Technical Analysis
The skill instructs the agent to run
echo $SUPERX_API_KEYto determine whether the environment variable exists. This prints the complete secret into the Bash tool output instead of merely checking whether the variable is set.Tool output may be retained in conversation context, execution logs, telemetry, debugging records, or other transcript storage. This contradicts the preceding instruction to use the key silently and unnecessarily increases credential exposure. The issue does not require the API itself to be compromised; disclosure occurs locally when the prescribed command is executed.
Attack Path
- A user invokes the skill for an image, video, music, or related operation.
- The agent follows the authentication workflow in
SKILL.md. - The agent executes
echo $SUPERX_API_KEY. - The complete API key is written to Bash tool output and potentially retained in logs or conversation context.
- A party able to access that output obtains the credential.
- The exposed key is reused in the
Authorizationheader against the SuperX API. - The unauthorized party can invoke chargeable API operations until the credential is revoked or the account balance is exhausted.
Impact Assessment
The exposed credential grants access to the SuperX account capabilities associated with the API key. An attacker could query the account balance, submit generation jobs, consume ...[truncated 412 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the instruction to print the environment variable.
-
Check only whether the variable is present:
bash if [ -n "${SUPERX_API_KEY:-}" ]; then echo "SUPERX_API_KEY is set" else echo "SUPERX_API_KEY is not set" fi -
Prefer a secret-aware HTTP or credential-management mechanism that does not place the key in generated command text or ordinary tool output.
-
Redact
Authorizationheader values from execution logs, error output, debugging traces, and command previews. -
Avoid asking users to disclose credentials in ordinary chat when a protected secret-input mechanism is available.
-
Document credential rotation and revocation procedures in case a key is exposed.
-
Ensure subprocess tracing and shell debugging modes such as
set -xare disabled while handling the key.
-
