T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:219
- Finding
- Browser Session Credential Exposed to General-Purpose Subagents<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:219-250` **Additional Locations**: `SKILL.md:259-280`, `SKILL.md:289-310`, `SKILL.md:885-927`, `SKILL.md:939-975`, `SKILL.md:987-1029` **Vulnerability Type**: Plaintext credential propagation across agent boundaries **Risk Level**: Medium ### Vulnerable Code ```typescript Task({ subagent_type: "general-purpose", description: "Track new prompt workflow", prompt: ` Help the user track a new prompt on The Prompting Company platform. Context: - Brand ID: ${brandId} - Session token: ${TPC_SESSION_TOKEN} - Base URL: https://app.promptingco.com Steps: 1. Ask user for the prompt text they want to track 2. Check for duplicates: GET /api/v1/prompts/check-duplicates?brandId=${brandId}&message=<prompt_text> 3. If duplicate exists, ask user if they want to continue 4. Fetch user personas: GET /api/v1/personas?brandId=${brandId} 5. Use the first persona as default (or let user select if multiple) 6. Create prompt with 4 conversation queries (one per engine): POST /api/v1/conversation-queries/bulk Body: { "brandId": "${brandId}", "queries": [ { "prompt": "<user_text>", "model": "chatgpt", "maxTurns": 1, "userPersonaId": "<PERSONA_ID>", "userPersona": "<PERSONA_NAME>" }, { "prompt": "<user_text>", "model": "gemini", "maxTurns": 1, "userPersonaId": "<PERSONA_ID>", "userPersona": "<PERSONA_NAME>" }, { "prompt": "<user_text>", "model": "deepseek", "maxTurns": 1, "userPersonaId": "<PERSONA_ID>", "userPersona": "<PERSONA_NAME>" }, { "prompt": "<user_text>", "model": "sonar", "maxTurns": 1, "userPersonaId": "<PERSONA_ID>", "userPersona": "<PERSONA_NAME>" } ] } 7. Confirm creation: "Created prompt tracked across ChatGPT, Gemini, DeepSeek, and Perplexity" Use the session token in all requests: -H "Cookie: __Secure-better-auth.session_token=${TPC_SESSION_TOKEN} ...[truncated 2126 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Never interpolate session cookies, API keys, or other credentials into Task prompts. 2. Route all authenticated requests through a dedicated API wrapper owned by the parent agent. 3. Have the wrapper inject the Cookie header only at request time through a secret-aware request facility. 4. Delegate only non-sensitive data, such as the selected brand ID, desired operation, and already-sanitized API results. 5. Replace browser session cookies with narrowly scoped API tokens where the platform supports them. 6. Scope separate tokens to read-only analytics, prompt management, and publishing operations. 7. Prevent credentials from appearing in prompts, logs, traces, errors, command output, and process arguments. 8. Redact Cookie and authorization headers in observability systems. 9. Rotate any token that may already have been exposed through historical Task traces. 10. Require explicit user confirmation immediately before publishing or other externally visible operations. ]]>
