T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:12- Finding
Discord Credential Isolation Bypass Exposes an Overprivileged Bot Token
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:12-37
Vulnerability Type: Credential isolation bypass and excessive privilege exposure
Risk Level: HighVulnerable Code Snippet:
markdown Additionally, OpenClaw redacts the Discord bot token from `openclaw config get` and environment variables (by design), so agents cannot make direct Discord API calls using the configured token. ## Solution Store the Discord bot token in a separate file accessible to the agent, then use `curl` to call the Discord API directly. ### Setup (one-time, run as the user) ```bash # Store your bot token in a file outside the workspace (won't be git-committed) echo 'YOUR_DISCORD_BOT_TOKEN' > ~/.openclaw/.discord-bot-token chmod 600 ~/.openclaw/.discord-bot-tokenRecord the path in
TOOLS.mdso the agent knows where to find it across sessions.Reading Messages
bash # Load token DISCORD_TOKEN=$(cat ~/.openclaw/.discord-bot-token) # Read recent messages from a channel or thread (threads are channels in Discord) curl -s -H "Authorization: Bot $DISCORD_TOKEN" \ "https://discord.com/api/v10/channels/{channel_or_thread_id}/messages?limit=50" \ | python3 -m json.tooltext ### Technical Analysis The Skill explicitly identifies OpenClaw's token redaction as a deliberate security boundary and instructs the user to circumvent it by duplicating the raw Discord bot token into a file readable by the agent. Although `chmod 600` prevents access by other operating-system users, it does not protect the token from the agent to which it is intentionally exposed. Direct possession of the credential is broader than the declared requirement to retrieve selected channel or thread history. The token carries every Discord permission granted to the bot identity, rather than a capability limited to one channel, one request, or read-only message retrieval. The document itself acknowledges that the bot token can ...[truncated 1774 chars]- Remediation
View remediation
Remediation Suggestions
- Do not make the raw Discord token readable by the agent.
- Implement a trusted credential-holding tool or local proxy that performs Discord requests without returning or exposing the token.
- Restrict the proxy to approved
GETendpoints used for channel and thread history. - Enforce explicit guild and channel allowlists and validate all channel identifiers before issuing requests.
- Require per-request user authorization for access to channels outside a predefined scope.
- Use a dedicated bot identity with only
View ChannelandRead Message Historypermissions; remove message-sending, moderation, administration, and other unnecessary permissions. - Apply response-size limits, pagination limits, audit logging, and Discord rate-limit handling in the trusted tool.
- Store the credential in an operating-system secret store or managed credential service available only to the trusted proxy.
- Rotate the currently exposed token after migrating to the constrained design.
- Add secret-redaction controls for command output, logs, errors, and diagnostic traces.
