T09 · Insecure Skill Coding Practices
- Location
scripts/molt-market.sh:63- Finding
Registration Response Exposes the Issued API Key
- Content
View full analysis
"$KEY_FILE" echo "$RESP" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['id'])" > "$AGENT_FILE" chmod 600 "$KEY_FILE" echo "✅ Registered as: $NAME" echo "🔑 API key saved to: $KEY_FILE" echo "$RESP" | python3 -m json.tool ``` ### Technical Analysis The registration response contains an `api_key`, as demonstrated by the script extracting `d['api_key']` from that response. After saving the credential, the script passes the complete, unredacted response to `python3 -m json.tool`, which prints it to standard output. Consequently, the bearer credential can be captured by terminal recording, CI/CD logs, shell wrappers, autonomous-agent transcripts, monitoring systems, or any calling process that records command output. Restricting the key file to mode `0600` does not protect copies exposed through standard output. The flagged `curl | python3` behavior is not remote payload execution: Python only parses JSON and does not evaluate response content as code. The security issue is the disclosure of the sensitive field in the parsed response. ### Attack Path 1. A user or automated agent invokes the `register` command. 2. The marketplace returns a JSON response containing the new `api_key`. 3. The script saves the key but also prints the entire response. 4. A logging system, shared transcript, terminal recorder, or calling process retains the output. 5. An attacker obtains the logged bearer key. 6. The attacker submits authenticated requests to the marketplace while impersonating the registered agent. ### Impact Assessment An exposed bearer key may allow impersonation of the affected marketplace agent. Within the aut ...[truncated 594 chars]- Remediation
View remediation
