T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:12
- Finding
- Hardcoded Moltbook API Credential<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:12-16` **Vulnerability Type**: Hardcoded secret exposure **Risk Level**: High ### Vulnerable Code ```markdown API credentials stored in `~/.config/moltbook/credentials.json`: ```json { "api_key": "clh_-Y5CvhWaIDPHXS3AInSGhNKLgDIdCiGmL81cvlozmag", "agent_name": "Gemini-Spark" } ``` ``` ### Technical Analysis `SKILL.md` contains a credential-shaped API token rather than an unambiguous placeholder. This directly contradicts the documentation claims that credentials are never committed to the repository. Because Skill instructions are distributed with the package and loaded into agent context, the token is available to every user who downloads or inspects the Skill. Restricting permissions on a separate local credentials file does not protect a credential already embedded in the repository. The script sends Moltbook tokens as Bearer credentials: ```bash -H "Authorization: Bearer ${API_KEY}" ``` Consequently, if the exposed token remains active, it can be reused independently of the supplied script. ### Attack Path 1. An attacker downloads or inspects the Skill package. 2. The attacker extracts the token from `SKILL.md`. 3. The attacker sends requests containing `Authorization: Bearer <exposed-token>` to the Moltbook API. 4. If the token remains valid, the attacker performs actions authorized for the associated `Gemini-Spark` account, including potentially creating posts or comments. 5. Activity generated with the stolen token may be attributed to the legitimate agent. ### Impact Assessment The exposed token may permit unauthorized use of the affected Moltbook account. The precise privileges depend on the server-side scope assigned to the token, but the documented API supports reading posts and authenticated creation of posts and comments. Potential consequences include: - Impersonation of the affected agent. - Unauthorized publication of posts and replies. - Abuse of account reputatio ...[truncated 352 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Immediately revoke the published API token through Moltbook. 2. Generate a replacement token and store it only through the OpenClaw credential provider or a protected local configuration file. 3. Replace the committed value with an unmistakable placeholder: ```json { "api_key": "YOUR_MOLTBOOK_API_KEY", "agent_name": "YOUR_AGENT_NAME" } ``` 4. Search the complete repository history, release artifacts, package registries, logs, and forks for the exposed token. 5. Treat rotation as mandatory even if the current file is corrected, because deleting a secret from the latest revision does not remove previous copies. 6. Add automated secret scanning to CI and pre-commit checks. 7. Ensure examples use synthetic values that cannot be mistaken for operational credentials. 8. Review Moltbook account activity for unauthorized posts, comments, or token use. ]]>
