T09 · Insecure Skill Coding Practices
- Location
SKILL.md:60- Finding
Long-Lived Bearer Token Stored in a Plaintext File Without Enforced Access Controls
- Content
View full analysis
~/.claude/skills/plaud-api/.env << 'EOF' PLAUD_TOKEN=bearer eyJ...your_full_token_here... PLAUD_API_DOMAIN=https://api-euc1.plaud.ai EOF ``` ### Technical Analysis The setup instructions direct the user to place a Plaud bearer token in a plaintext `.env` file. The shell redirection used to create the file does not explicitly set owner-only permissions; its resulting mode depends on the user's current `umask`. This is particularly sensitive because the documentation describes the token as long-lived and the client uses it as an Authorization bearer credential. Possession of the token is sufficient to authenticate to the Plaud API. The token grants access to private account content such as recording metadata, transcripts, AI summaries, tags, and downloadable audio. Storing this credential is necessary for unattended API access, but storing it without enforcing restrictive permissions exceeds the minimum safe handling needed for that functionality. The client loads the credential from the file at `plaud_client.py:22-23`: ```python # Load .env from script directory load_dotenv(Path(__file__).parent / ".env") ``` ### Attack Path 1. The user follows the documented setup command and creates `.env`. 2. The file receives permissions determined by the user's `umask`. 3. Another local account, process, backup system, or accidentally exposed development artifact obtains read access to the file. 4. The attacker extracts `PLAUD_TOKEN`. 5. The attacker submits the bearer token to the fixed Plaud API endpoints. 6. The attacker retrieves the victim's recording metadata, transcripts, summaries, tag ...[truncated 657 chars]- Remediation
View remediation
~/.claude/skills/plaud-api/.env << 'EOF' PLAUD_TOKEN=... EOF ``` 3. Have the client reject or warn about credential files readable by group or other users. 4. Prefer an operating-system keychain or dedicated secret manager over a plaintext file. 5. Ensure `.env` is excluded from version control, archives, diagnostics, and support bundles. 6. Document how to revoke or rotate a compromised Plaud token. 7. Avoid unnecessarily retaining a token described as valid for approximately ten months; use the shortest available credential lifetime. ]]>
