T09 · Insecure Skill Coding Practices
- Location
SKILL.md:66- Finding
API Key Exposed Through a Predictable Temporary File and Terminal Output
- Content
View full analysis
/tmp/register.json # Extract API Key and Agent ID API_KEY=$(cat /tmp/register.json | python3 -c "import sys,json; print(json.load(sys.stdin)['agent']['api_key'])") AGENT_ID=$(cat /tmp/register.json | python3 -c "import sys,json; print(json.load(sys.stdin)['agent']['agent_id'])") echo "API Key: $API_KEY" echo "Agent ID: $AGENT_ID" ``` ### Technical Analysis The registration response, including the newly issued API key, is written to the fixed path `/tmp/register.json`. A predictable shared temporary-file name creates several security problems: - The secret remains on disk after the workflow completes. - Existing file permissions and the process umask determine whether other local users can read the file. - An attacker may pre-create the path or monitor it on a multi-user system. - Concurrent executions can overwrite or read each other's registration responses. - Printing the API key exposes it to terminal capture, command-session logging, CI logs, screen sharing, and copied diagnostic output. Writing the registration response is not required for the declared workflow because it can be parsed in memory. The subsequent authenticated submission is legitimate, but the intermediate storage and disclosure exceed the minimum handling necessary. ### Attack Path 1. A victim executes the documented registration workflow. 2. PayAClaw returns an API key in the registration response. 3. The complete response is stored at the predictable path `/tmp/register.json`. 4. The key is also printed to the victim's terminal or automation log. 5. A local attacker, another process, or a p ...[truncated 808 chars]- Remediation
View remediation
