T09 · Insecure Skill Coding Practices
- Location
references/code-examples/bria_client.sh:14- Finding
Environment-Controlled API Base Can Exfiltrate Credentials and Image Data
- Content
View full analysis
"$payload" elif printf '%s' "$image" | grep -qE '^https?://'; then if [ "$key" = "images" ]; then printf '{"images": ["%s"]' "$image" > "$payload" else printf '{"%s": "%s"' "$key" "$image" > "$payload" fi else [ ! -f "$image" ] && { echo "ERROR: File not found: $image" >&2; return 1; } if [ "$key" = "images" ]; then printf '{"images": ["' > "$payload" else printf '{"%s": "' "$key" > "$payload" fi base64 < "$image" | tr -d '\n' >> "$payload" if [ "$key" = "images" ]; then printf '"]' >> "$payload" else printf '"' >> "$payload" fi fi ``` ```bash http_code=$(curl -s -o "$result" -w '%{http_code}' -X POST \ "${BRIA_API_BASE}${endpoint}" \ -H "api_token: $BRIA_API_KEY" \ -H "Content-Type: application/json" \ -H "User-Agent: $BRIA_USER_AGENT" \ -d @"$payload") ``` ### Technical Analysis The helper permits the inherited `BRIA_API_BASE` environment variable to replace the expected Bria API origin without validating its scheme, hostname, or port. The same destination then receives the `BRIA_API_KEY` authentication header and the complete request payload. For local files, the payload includes a base64 representation of the selected image. It may also include user prompts, editing instructions, image URLs, masks, and other user-provided data. Sending those values to the actual Bria API is necessary for the declared functionality, but allowing the credential-bearing destination to be changed arbitrarily is not. This vulnerability is exploitable when an attacker can influence the environment from which the Skill is invoked, such as through ...[truncated 1046 chars]- Remediation
View remediation
