T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:22
- Finding
- LINE Authentication Tokens Stored in a Predictable Plaintext File## Vulnerability Details **File Location**: `SKILL.md`, lines 13 and 22–25 **Vulnerability Type**: Plaintext sensitive credential storage **Risk Level**: Medium ### Vulnerable Code ```markdown - **Token storage:** `~/.line-client/tokens.json` ``` ```python import json from pathlib import Path from src.chrome_client import LineChromeClient tokens = json.loads((Path.home() / ".line-client" / "tokens.json").read_text()) client = LineChromeClient(auth_token=tokens["auth_token"]) ``` The QR authentication documentation also establishes that the stored material can include an authentication token and refresh token: ```python # result.auth_token, result.mid, result.refresh_token ``` ### Technical Analysis The Skill instructs users to persist and load LINE authentication credentials from the predictable path `~/.line-client/tokens.json`. It does not require restrictive directory or file permissions, an operating-system credential store, encryption at rest, token minimization, output redaction, or secure deletion. Authentication and refresh tokens are sensitive bearer credentials. Any local process or user that can read this file may be able to reuse them without knowing the account password. The predictable path also makes the credentials straightforward to target through malicious local software, overly broad backup jobs, support bundles, or accidental file disclosure. Network access to LINE is necessary for the Skill's declared messaging functionality, and the audited document does not direct credentials to an unrelated endpoint. The security issue is therefore the insufficiently protected local storage of credentials rather than the required transmission to LINE's gateway. ### Attack Path 1. The user completes QR authentication and persists the resulting authentication or refresh token in `~/.line-client/tokens.json`. 2. The file or its parent directory is created with permissions that allow an unintended local user or process to read it, or it is copied ...[truncated 1343 chars]
- Remediation
- ## Remediation Suggestions 1. Store authentication and refresh tokens in an operating-system credential manager, such as macOS Keychain, Windows Credential Manager, or Linux Secret Service. 2. If file storage is unavoidable: - Create `~/.line-client` with mode `0700`. - Create `tokens.json` atomically with mode `0600`. - Reject or warn about files owned by another user or accessible by group/other accounts. - Avoid following symbolic links when creating or updating the file. 3. Persist only credentials strictly required for the requested workflow. Avoid storing refresh tokens when short-lived authentication is sufficient. 4. Never print tokens, QR secrets, certificates, or refresh credentials to logs, standard output, exceptions, telemetry, or support bundles. 5. Provide explicit logout, token revocation, rotation, and secure-deletion procedures. 6. Require login PINs and QR authentication material to be delivered only through an explicitly selected, trusted user-facing channel. Do not broadcast them or send them through arbitrary callbacks. 7. Document token lifetime and compromise-response steps, including immediate revocation and reauthentication. 8. Pin and independently audit the referenced external Python, JavaScript, and WASM implementation before entrusting it with account credentials, because those implementation files were not included in the audited artifact.
