T09 · Insecure Skill Coding Practices
- Location
scripts/clawtter.sh:5- Finding
API Credential Disclosure Through an Unrestricted Configurable Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
scripts/clawtter.sh:5-6, with authenticated request sinks atscripts/clawtter.sh:57-60,74-77,89-92,106-109, and128-130
Vulnerability Type: Credential disclosure through an unvalidated destination
Risk Level: HighVulnerable Code
bash API_BASE="${CLAWTTER_API_BASE:-https://api.clawtter.io}" API_KEY="${CLAWTTER_API_KEY:-}"The configurable endpoint and credential are later combined in authenticated requests, including:
bash curl -s -X POST "$API_BASE/posts" \ -H "Content-Type: application/json" \ -H "X-Agent-Key: $API_KEY" \ -d "{\"text\":\"$text\",\"post_type\":\"$post_type\",\"confidence\":0.8}"Other authenticated commands use the same pattern:
bash curl -s -X POST "$API_BASE/feedback" \ -H "Content-Type: application/json" \ -H "X-Agent-Key: $API_KEY" \ -d "{\"post_id\":\"$post_id\",\"action\":\"like\"}"bash curl -s -X POST "$API_BASE/comments" \ -H "Content-Type: application/json" \ -H "X-Agent-Key: $API_KEY" \ -d "{\"post_id\":\"$post_id\",\"text\":\"$text\"}"bash curl -s -X DELETE "$API_BASE/posts/$post_id" \ -H "X-Agent-Key: $API_KEY"Technical Analysis
CLAWTTER_API_BASEis accepted without validating its scheme or destination host. Every authenticated operation then sends the value ofCLAWTTER_API_KEYin theX-Agent-Keyheader to that endpoint.If an attacker can influence the process environment, wrapper configuration, launch command, or automation configuration, the attacker can set
CLAWTTER_API_BASEto an attacker-controlled server. The next authenticated invocation will disclose the API key. The implementation also permits anhttp://endpoint, which can expose the credential to network interception.This is not an arbitrary local command-execution vulnerability because the URL remains shell-quoted. The issue is unauthorized discl ...[truncated 1216 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
CLAWTTER_API_BASEconfigurability if alternate endpoints are not required. - If endpoint overrides are required, parse and validate the URL before making requests.
- Require the
httpsscheme and reject plaintext HTTP. - Maintain an explicit allowlist of trusted hostnames, such as
api.clawtter.io. - Reject URLs containing user information, unexpected ports, fragments, or unapproved redirect destinations.
- Configure
curlto fail safely, restrict protocols, and avoid forwarding credentials across redirects. Appropriate options include--fail-with-body,--proto '=https', and a conservative redirect policy. - Use separate credentials for development or staging endpoints rather than sending the production key to a configurable destination.
- Document that environment variables controlling authenticated destinations are security-sensitive.
- Rotate the API key immediately if it may already have been sent to an untrusted endpoint.
- Remove
