T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:15
- Finding
- Unvalidated API Endpoint Can Expose User Credentials and Bearer Tokens## Vulnerability Details **File Location**: `SKILL.md`, lines 15–40 **Vulnerability Type**: Unvalidated credential destination and insecure secret handling **Risk Level**: High The skill permits `POKERCLAW_API_URL` to be supplied through an environment variable or directly by the user. It then sends login credentials and bearer tokens to that destination without requiring HTTPS, validating the hostname, or restricting the endpoint to an approved POKERCLAW origin. **Vulnerable code:** ```markdown - **API URL**: Stored in `POKERCLAW_API_URL` env var (e.g., `https://your-pokerclaw-instance.com`) - **Auth Token**: Stored in `POKERCLAW_TOKEN` env var (JWT token from login/register) If these are not set, ask the user to provide: 1. The POKERCLAW server URL 2. Their login credentials (email + password) OR ask if they want to register a new agent ## API Reference All endpoints are prefixed with `{POKERCLAW_API_URL}/api/agent-api/`. Include the auth token as `Authorization: Bearer {POKERCLAW_TOKEN}` header on all requests except register/login. ### Authentication **Register a new agent:** ```bash curl -X POST "{POKERCLAW_API_URL}/api/agent-api/register" \ -H "Content-Type: application/json" \ -d '{"username": "my_claw", "email": "claw@example.com", "password": "secure123", "agent_name": "ClawBot_Prime"}' ``` Response includes `token` - save this as `POKERCLAW_TOKEN`. **Login:** ```bash curl -X POST "{POKERCLAW_API_URL}/api/agent-api/login" \ -H "Content-Type: application/json" \ -d '{"email": "claw@example.com", "password": "secure123"}' ``` ``` ### Technical Analysis The confidentiality of the authentication flow depends entirely on the value of `POKERCLAW_API_URL`. Because the skill accepts a user-provided URL and does not define an origin allowlist, a maliciously supplied endpoint can receive the user's email address and password during login or registration. Every subsequent authenticated ...[truncated 2085 chars]
- Remediation
- ## Remediation Suggestions 1. Pin `POKERCLAW_API_URL` to the official service origin or enforce a strict allowlist of approved HTTPS hostnames. 2. Reject cleartext HTTP, embedded URL credentials, IP-literal destinations where unnecessary, malformed URLs, and unexpected ports. 3. Disable redirects for authentication requests or verify that every redirect remains on the approved HTTPS origin. 4. Validate the server certificate using the operating system's trusted certificate store; do not permit insecure TLS options. 5. Do not request passwords through ordinary chat messages. Use a protected credential prompt, secret manager, or externally completed authentication flow. 6. Avoid placing passwords directly in command-line arguments. Supply request data through a protected input channel or temporary file with restrictive permissions, and securely remove temporary material afterward. 7. Provision `POKERCLAW_TOKEN` through a secret-management mechanism and prevent it from appearing in logs, transcripts, error messages, or command traces. 8. Scope tokens to the minimum required API permissions, use short expiration periods, and support immediate revocation and rotation. 9. Clearly warn users not to provide credentials reused on other services.
