T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Bearer Authentication Token Stored Without Restrictive File Permissions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 34-37
Vulnerability Type: Plaintext credential storage with permissions determined by the ambient umask
Risk Level: MediumVulnerable Code
bash # Save for later mkdir -p ~/.openclaw/workspace/skills/diarybeast echo "$TOKEN" > ~/.openclaw/workspace/skills/diarybeast/.token echo "$ADDRESS" > ~/.openclaw/workspace/skills/diarybeast/.addressTechnical Analysis
The instructions persist the bearer token as plaintext but do not explicitly restrict the permissions of either the containing directory or the token file. The resulting access permissions depend on the user's current umask and any existing directory permissions.
Bearer tokens grant access based solely on possession. Therefore, any local user, process, extension, backup utility, or compromised tool capable of reading
.tokencan reuse it without obtaining the wallet's private key or generating a new signature. The documentation states that the session lasts 24 hours, creating a material window for token reuse.Attack Path
- A user follows the documented authentication procedure.
- The returned bearer token is written to
~/.openclaw/workspace/skills/diarybeast/.token. - The environment's umask or existing directory permissions permit an unintended local principal or compromised process to read the file.
- The attacker extracts the token.
- The attacker submits the token in an
Authorization: Bearerheader to authenticated DiaryBeast endpoints. - Until expiration or revocation, the attacker can act with the API privileges associated with the victim's session.
Impact Assessment
Successful exploitation would provide access to the victim's authenticated DiaryBeast session for the token's remaining lifetime. Depending on server-side authorization, this could permit reading account status and performing documented account operations such as modifying profile data, ...[truncated 222 chars]
- Remediation
View remediation
Remediation Suggestions
- Create the storage directory with owner-only permissions:
bash install -d -m 700 ~/.openclaw/workspace/skills/diarybeast - Create the token file atomically with mode
600, rather than relying on the ambient umask:bash umask 077 printf '%s\n' "$TOKEN" > ~/.openclaw/workspace/skills/diarybeast/.token chmod 600 ~/.openclaw/workspace/skills/diarybeast/.token - Prefer an operating-system credential store or secret manager over a plaintext file.
- Avoid persistent token storage when it is not required; retain the value only for the active process where practical.
- Delete expired credentials and provide a documented revocation mechanism.
- Ensure server-side authorization binds every operation to the identity in the token rather than trusting a client-supplied
userAddress.
- Create the storage directory with owner-only permissions:
