T09 · Insecure Skill Coding Practices
- Location
clawtank.js:12- Finding
Bearer Token Can Be Redirected to an Arbitrary Network Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
clawtank.js:12-13, with credential transmission atclawtank.js:60-62,103-113,130-141,158-170, and220-231
Vulnerability Type: Unrestricted credential forwarding to a configurable endpoint
Risk Level: HighVulnerable Code
js const IDENTITY_FILE = path.resolve(process.cwd(), '.clawtank_identity'); const DEFAULT_HUB = 'https://clawtank.vercel.app'; const HUB_URL = process.env.CLAW_HUB_URL || DEFAULT_HUB;Representative authenticated request:
js const res = await fetch(`${HUB_URL}/api/swarm/signals?unresolved=true`, { headers: { 'Authorization': `Bearer ${auth.api_key}` } });The same bearer-token pattern is used for peer reviews, finding submissions, votes, and chat messages:
js headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${auth.api_key}` }Technical Analysis
The
CLAW_HUB_URLenvironment variable can replace the documented hub with any URL. The implementation does not validate the URL scheme, hostname, port, or origin before attaching the bearer token.Consequently, authenticated commands may transmit the token to an attacker-controlled server or over unencrypted HTTP. Supporting custom deployments can be legitimate, but unrestricted forwarding of an existing production credential is broader than the minimum privileges required. The documentation only identifies the default hub and does not warn users that an environment variable can redirect credentials.
This is not evidence of deliberate exfiltration because the default destination is the documented HTTPS service. It is nevertheless an exploitable credential-disclosure path.
Attack Path
- An attacker gains influence over the execution environment, such as a shell profile, environment file, task runner, wrapper script, CI configuration, or parent process.
- The attacker sets `CLAW_H ...[truncated 1197 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse the configured endpoint with
new URL()and reject malformed values. - Require the
https:scheme; permit plaintext HTTP only for an explicitly enabled local-development mode restricted to loopback addresses. - Use an allowlist of trusted hostnames and ports. If custom hubs are necessary, require explicit enrollment rather than trusting an ambient environment variable.
- Store separate credentials per hub. Never send the default service's bearer token to a custom origin.
- Disable automatic cross-origin redirects for authenticated requests, or verify every redirect target before forwarding authorization headers.
- Document
CLAW_HUB_URL, its security implications, and the exact destination receiving credentials. - Consider displaying the authenticated destination before first use and requiring confirmation when it differs from the default origin.
- Apply short token lifetimes, narrowly scoped API permissions, rotation support, and server-side revocation.
- Parse the configured endpoint with
