T09 · Insecure Skill Coding Practices
- Location
scripts/inbox.sh:4- Finding
Bearer Credentials Can Be Redirected to an Untrusted or Plaintext Endpoint
- Content
View full analysis
Vulnerability Details
File Locations:
scripts/inbox.sh:4,31-33scripts/respond.sh:4,45-50scripts/update-card.sh:4,65-70README.md:66-69
Vulnerability Type: Unvalidated destination for authenticated network requests
Risk Level: HighVulnerable Code
scripts/inbox.sh:4,31-33:bash BASE_URL="${SCHELLING_URL:-https://schellingprotocol.com}" RESPONSE=$(curl -sf \ -H "Authorization: Bearer ${API_KEY}" \ "${BASE_URL}/api/cards/${SLUG}/requests") || {scripts/respond.sh:4,45-50:bash BASE_URL="${SCHELLING_URL:-https://schellingprotocol.com}" RESPONSE=$(curl -sf \ -X PUT \ -H "Authorization: Bearer ${API_KEY}" \ -H "Content-Type: application/json" \ -d "$BODY" \ "${BASE_URL}/api/cards/${SLUG}/requests/${REQUEST_ID}") || {scripts/update-card.sh:4,65-70:bash BASE_URL="${SCHELLING_URL:-https://schellingprotocol.com}" RESPONSE=$(curl -sf \ -X PUT \ -H "Authorization: Bearer ${API_KEY}" \ -H "Content-Type: application/json" \ -d "$BODY" \ "${BASE_URL}/api/cards/${SLUG}") || {README.md:66-69:bash Set `SCHELLING_URL` to use a different server (useful for local development): export SCHELLING_URL=http://localhost:3000Technical Analysis
The authenticated scripts derive the complete destination origin from the externally controlled
SCHELLING_URLenvironment variable. They do not validate its scheme, hostname, port, or trust level before attaching the bearer API key.Consequently, an inherited or attacker-modified environment can redirect the authenticated request to an arbitrary server. The documentation also explicitly permits an HTTP URL. When HTTP is used, the authorization header and request content are transmitted without transport encryption and may be captured by a network-positioned attacker.
Although the default endpoint uses HTTPS, that default does not protect exec ...[truncated 1564 chars]
- Remediation
View remediation
Remediation Suggestions
- Require HTTPS for every request carrying an API key. Reject URLs whose parsed scheme is not exactly
https. - Allowlist
schellingprotocol.comas the authenticated production origin rather than trusting an unrestricted environment variable. - If local development is necessary, require an explicit opt-in flag and restrict insecure HTTP to loopback addresses such as
127.0.0.1and::1. - Parse and validate the URL structurally; do not rely on string-prefix checks that can be bypassed with crafted hostnames or user-info components.
- Separate public and authenticated endpoint configuration. An endpoint accepted for unauthenticated search should not automatically be trusted to receive credentials.
- Configure
curlwith appropriate TLS verification and redirect restrictions. Avoid forwarding authorization headers across redirects to a different origin. - Document how users can revoke and rotate a credential after suspected endpoint redirection or plaintext exposure.
- Require HTTPS for every request carrying an API key. Reject URLs whose parsed scheme is not exactly
