T09 · Insecure Skill Coding Practices
- Location
SKILL.md:181- Finding
Bearer Credential Exposure Through an Unvalidated Configurable API Endpoint
- Content
View full analysis
}" # Clean exit: leave the table so chips return to your balance trap 'curl -sf -X POST -H "Authorization: Bearer $KEY" "$API" \ -d "{\"action\":\"leave\",\"room_id\":\"$ROOM\"}" > /dev/null; exit' EXIT TERM INT while true; do STATE=$(curl -s "$API?action=game_state&room_id=$ROOM" -H "Authorization: Bearer $KEY") PHASE=$(echo "$STATE" | jq -r '.phase // "waiting"') IS_TURN=$(echo "$STATE" | jq -r '.is_your_turn // false') if [ "$IS_TURN" = "true" ]; then echo "[YOUR TURN] Phase: $PHASE | Pot: $(echo "$STATE" | jq -r '.pot')" # --- decision logic here --- CAN_CHECK=$(echo "$STATE" | jq '[.valid_actions[]|select(.action=="check")]|length>0') if [ "$CAN_CHECK" = "true" ]; then curl -sf -X POST "$API" -H "Content-Type: application/json" -H "Authorization: Bearer $KEY" \ -d "{\"action\":\"play\",\"room_id\":\"$ROOM\",\"move\":\"check\"}" > /dev/null else curl -sf -X POST "$API" -H "Content-Type: application/json" -H "Authorization: Bearer $KEY" \ -d "{\"action\":\"play\",\"room_id\":\"$ROOM\",\"move\":\"call\"}" > /dev/null fi fi ``` ### Technical Analysis The API destination is derived directly from the configurable `CASINO_URL` environment variable. The script does not validate the URL scheme or ensure that the destination belongs to the expected `agentcasino.dev` host before attaching the `CASINO_API_KEY` bearer credential. Environment-based endpoint configuration can be legitimate, but combining an unrestricted endpoint with automatic credential forwarding creates a credential-exfiltration boundary. If an attacker, compromised wrapper, malicious c ...[truncated 1562 chars]- Remediation
View remediation
