T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/setup-credentials.sh:13
- Finding
- Browser Session Token Exposed Through Agent Conversation and Process Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup-credentials.sh:13-48`; related instructions in `SKILL.md:45-64` **Vulnerability Type**: Unsafe handling of a bearer-equivalent browser session token **Risk Level**: High ### Vulnerable Code ```bash # Get session token from argument or prompt if [ -n "$1" ]; then SESSION_TOKEN="$1" else echo "Step 1: Get your session token" echo "1. Sign in to https://getaiform.com" echo "2. Open browser DevTools (F12)" echo "3. Go to Application → Cookies" echo "4. Find 'better-auth.session_token'" echo "5. Copy its value" echo "" read -p "Paste your session token: " SESSION_TOKEN fi if [ -z "$SESSION_TOKEN" ]; then echo "Error: Session token is required" exit 1 fi echo "" echo "Fetching your user information via MCP..." # Call MCP get_user_info tool RESPONSE=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"tools/call\", \"params\": { \"name\": \"get_user_info\", \"arguments\": { \"sessionToken\": \"$SESSION_TOKEN\" } } }") ``` The corresponding Skill instruction explicitly tells the user to disclose the cookie and passes it as a command-line argument: ```bash .claude/skills/dashform/scripts/setup-credentials.sh "user-provided-token" ``` ### Technical Analysis The Skill asks the user to copy the `better-auth.session_token` browser cookie into the Agent conversation. A browser session cookie is a bearer credential: possession may be sufficient to act with the authenticated user's Dashform privileges until the session expires or is revoked. Although transmission to `https://getaiform.com/api/mcp` is declared and relevant to the Skill's function, the credential-handling mechanism is unsafe: 1. The token enters the Agent conversation ...[truncated 2368 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace browser-cookie collection with OAuth, device authorization, or another server-supported authentication flow. 2. Issue a short-lived token scoped only to required operations such as `get_user_info` and `create_form`. 3. Never ask users to paste session cookies into an Agent conversation. 4. Never pass secrets through command-line arguments. Read them from a protected credential store, a restricted file descriptor, or silent standard input. 5. If interactive input is temporarily unavoidable, use `read -r -s` and clear the variable immediately after use. 6. Construct the request with a JSON-aware tool such as `jq --arg` rather than directly interpolating the credential. 7. Prevent secret values from appearing in shell tracing, tool logs, telemetry, error output, and command histories. 8. Support explicit token revocation and expiration, and document how users can invalidate a potentially exposed session. 9. Clearly state that `https://getaiform.com/api/mcp` is a remote service and that authentication data leaves the local environment. ]]>
