T09 · Insecure Skill Coding Practices
- Location
SKILL.md:31- Finding
Plaintext Storage of Feishu OAuth Tokens in the Workspace
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 31–37
Vulnerability Type: Plaintext sensitive credential storage
Risk Level: MediumVulnerable Code Snippet
markdown ### 2. Token Management - The access token is valid for approximately 2 hours. - The refresh token is valid for approximately 30 days. - Use the refresh token to renew access after expiration. Tokens are stored in `~/.openclaw/workspace/feishu_tokens.md`.The snippet above is an English rendering of the corresponding instructions in
SKILL.md.Technical Analysis
The Skill explicitly instructs the Agent to persist OAuth access and refresh tokens in a Markdown file under the OpenClaw workspace. It does not require encryption, owner-only file permissions, exclusion from indexing and backups, or use of an operating-system credential store.
OAuth bearer tokens must be treated as secrets because possession is generally sufficient for API authentication. The refresh token is particularly sensitive because it remains valid for approximately 30 days and can be used to obtain replacement access tokens after the short-lived access token expires.
Storing these credentials in a workspace Markdown file may expose them to other local users or processes, workspace indexing tools, backup systems, synchronization services, diagnostic collection, or accidental repository inclusion. Exploitation requires an attacker or unintended process to gain read access to that file; the Skill does not itself transmit the token to an unrelated endpoint.
Attack Path
- A user completes the documented Feishu OAuth authorization process.
- The resulting access token and refresh token are stored in
~/.openclaw/workspace/feishu_tokens.mdas instructed. - Another local user, compromised process, workspace indexer, backup service, synchronization tool, or accidentally published artifact reads the plaintext file.
- The unauthorized party extr ...[truncated 941 chars]
- Remediation
View remediation
Remediation Suggestions
- Store OAuth access and refresh tokens in an operating-system keychain, managed secret store, or dedicated credential service rather than a Markdown workspace file.
- If file-backed storage is unavoidable, place the credential file outside the workspace and enforce owner-only permissions such as mode
0600on Unix-like systems. - Encrypt credentials at rest with keys maintained separately from the token file.
- Exclude credential files from source control, workspace indexing, synchronization, backup exports, diagnostics, and log collection.
- Never print tokens in command output or include them in generated reports. Redact authorization headers and token values from logs and errors.
- Request only the minimum Feishu OAuth scopes required for the active operation.
- Implement secure token rotation and immediate revocation after suspected exposure. Delete obsolete access and refresh tokens when authorization is removed.
- Document the expected token-file ownership and permission checks, and refuse to use storage that is readable by other users.
