T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:28
- Finding
- Bearer session tokens are exposed through query strings, redirects, and user copy/paste<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 28, 59, 68–71, and 91 **Vulnerability Type**: Bearer credential exposure through URLs and prompts **Risk Level**: High ### Vulnerable Code Snippets `SKILL.md:28` ```text Connect Google Business = {API_BASE_URL}/oauth2/connectGoogleBusiness?token=<url-encoded-token>&redirectState=<url-encoded-return-url> ``` `SKILL.md:59` ```text 3. The callback carries `?token=<token>`; store `Bearer <token>` as the session token (in web: `localStorage`; in app: uni storage under key `token`). ``` `SKILL.md:68–71` ```text 2. Give the merchant this URL: `{API_BASE_URL}/oauth2/authorization/google-autoreply?handoffId=<handoffId>` and ask them to complete the sign-in. After login the browser is **redirected back to `returnUrl` with `token` & `tokenHead` appended** (e.g. `returnUrl?token=...&tokenHead=...`). 3. Poll `GET /oauth2/handoff/<handoffId>/token` (every ~2–3s) until `data.status === "READY"`. - `PENDING` → keep polling. - `EXPIRED` → the slot expired / was never opened; create a new handoff and retry, or fall back to asking the merchant to paste the `?token=` value. ``` `SKILL.md:91` ```text {API_BASE_URL}/oauth2/connectGoogleBusiness?token=<url-encoded-token>&redirectState=<url-encoded-return-url> ``` ### Technical Analysis The Skill transports a bearer session credential in OAuth callback URLs, redirect URLs, and the Google Business connection query string. URL encoding changes the representation of the token but does not provide confidentiality. Sensitive query parameters may be retained or disclosed through: - Browser history and synchronized browsing data - Web server, reverse-proxy, CDN, and monitoring logs - Analytics and error-reporting systems - Screenshots, screen sharing, and support records - Clipboard history when a user is asked to paste a token-bearing URL - Browser extensions or local malware with browsing-data access - `Referer` headers, depending on redirect flow an ...[truncated 1980 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace bearer tokens in URLs with short-lived, opaque, single-use authorization codes. 2. Redeem each code through a server-to-server back channel, binding it to: - The intended client and user session - A strict audience - The original redirect URI - A short expiration time - A cryptographically random state or PKCE verifier 3. Never append `token`, `tokenHead`, or an equivalent reusable credential to `returnUrl`. 4. Change the Google Business connection flow so it accepts a one-time connection grant rather than the merchant's login bearer token. 5. Remove the fallback that asks the merchant to paste a token or token-bearing URL. 6. Apply a strict `Referrer-Policy`, such as `no-referrer`, to authentication and callback pages as defense in depth. 7. Redact sensitive query parameters from proxy, CDN, application, analytics, and error-reporting logs. 8. Invalidate all credentials previously exposed by legacy URL-based flows and require affected sessions to authenticate again. 9. Add automated tests that reject authentication URLs containing bearer tokens or equivalent credentials. ]]>
