T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:12
- Finding
- Reusable Session Tokens Persisted in Plaintext<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 12–21, 36–37, and 61–77 **Vulnerability Type**: Plaintext storage of reusable authentication credentials **Risk Level**: High The Skill directs the agent to persist access and refresh tokens in `TOOLS.md`. Although persistence requires user consent and the documentation warns that the values are stored in plaintext, these tokens remain bearer credentials that grant access to the user's account. ### Vulnerable Code ```markdown On first use, check TOOLS.md for an `### I'm Pretty Amazing` section. Persisted auth data should include cookie values and JWT expiry metadata so auth can be reused until expiration: ```markdown ### I'm Pretty Amazing - **Username:** their-username (optional) - **Access Token Cookie:** eyJhbGciOi... - **Refresh Token Cookie:** eyJhbGciOi... (optional but recommended) - **Access Token Expires At (UTC):** 2026-03-21T03:04:46Z ``` ``` ```markdown After successful login, ask the user: "Want me to save your session tokens so you stay logged in for future requests? They'll be stored in plaintext in TOOLS.md and expire automatically. Decline if others can access your TOOLS.md." If they agree, persist `access_token`, `refresh_token` (if present), and access-token expiry in TOOLS.md. ``` ```bash IPA_COOKIE_FILE="/tmp/ipa-cookies-$$.txt" ACCESS_TOKEN="<Access Token Cookie from TOOLS.md>" REFRESH_TOKEN="<Refresh Token Cookie from TOOLS.md>" cat > "$IPA_COOKIE_FILE" <<EOF # Netscape HTTP Cookie File .imprettyamazing.com TRUE / TRUE 0 access_token $ACCESS_TOKEN .imprettyamazing.com TRUE / TRUE 0 refresh_token $REFRESH_TOKEN EOF ``` ### Technical Analysis Access and refresh tokens are bearer credentials: possession of a valid token is generally sufficient to act as the authenticated user. Placing these values in a general-purpose plaintext Markdown file exposes them to any local user, process, extension, backup system, or later agent session that can read that file. The ...[truncated 1621 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store persistent tokens in an operating-system credential store or dedicated secrets manager rather than `TOOLS.md`. 2. Keep only non-sensitive metadata, such as username and expiration time, in general agent context files. 3. If secure storage is unavailable, disable cross-session token persistence and require reauthentication in each session. 4. Prefer short-lived, narrowly scoped tokens where the API supports them. 5. Provide explicit token revocation when the user logs out or disables persistence. 6. Restrict any unavoidable credential file to the owning user with mode `0600`, exclude it from source control and backups, and avoid loading its contents into unrelated agent context. 7. Rotate or revoke any token suspected of having been exposed through an existing plaintext file. ]]>
