T09 · Insecure Skill Coding Practices
- Location
assets/discord-backend.ts:400- Finding
Discord Bot Token Is Stored in an Inconsistent Plaintext Configuration Field
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real Discord integration, but it can automatically change and restart Clawdbot while handling bot tokens in ways that are not fully safe or accurately described.
Review before installing. Run only in a test Clawdbot checkout first, use dry-run and skip-restart options where possible, back up the gateway/UI source tree, avoid passing live Discord tokens on the command line, prefer a real secret manager, grant the bot minimal Discord permissions, and be prepared for manual cleanup if uninstalling.
assets/discord-backend.ts:400Discord Bot Token Is Stored in an Inconsistent Plaintext Configuration Field
scripts/test-token.py:67Discord Bot Tokens Are Accepted and Documented Through Process Arguments
scripts/install-plugin.js:179Automatic Installer Performs Non-Transactional Host Source Modification Without Reliable Rollback
Claiming full Discord integration while apparently only validating tokens and listing guilds is a meaningful security concern because it can induce users to disclose credentials and approve invasive installation assumptions under false pretenses. The mismatch is more dangerous here because the skill discusses automatic backend/UI changes and bot-token handling, both of which are high-trust operations.
Claiming full Discord integration while apparently only validating tokens and listing guilds is a meaningful security concern because it can induce users to disclose credentials and approve invasive installation assumptions under false pretenses. The mismatch is more dangerous here because the skill discusses automatic backend/UI changes and bot-token handling, both of which are high-trust operations.
Claiming full Discord integration while apparently only validating tokens and listing guilds is a meaningful security concern because it can induce users to disclose credentials and approve invasive installation assumptions under false pretenses. The mismatch is more dangerous here because the skill discusses automatic backend/UI changes and bot-token handling, both of which are high-trust operations.
Claiming full Discord integration while apparently only validating tokens and listing guilds is a meaningful security concern because it can induce users to disclose credentials and approve invasive installation assumptions under false pretenses. The mismatch is more dangerous here because the skill discusses automatic backend/UI changes and bot-token handling, both of which are high-trust operations.
The code reads the configured bot token from config.channels?.discord?.botToken but discordSetToken writes it to config.channels.discord.token. As a result, the newly saved token is never used by the rest of the handlers, causing authentication failures, misleading connection state, and potentially leaving an older token active if one exists under the read key. In a credential-management skill, this inconsistency is especially dangerous because operators may believe they rotated or fixed a secret when the running system still uses stale credentials.
The implementation and comments claim the handler saves the Discord token to configuration, but it writes a different field than the rest of the backend reads. That creates a silent configuration integrity bug: the UI or caller receives a success result and restart notice even though subsequent operations will still report no token or use the wrong one. In this skill’s context, which automates credential management and service restarts, deceptive success states increase the likelihood of outage and failed secret rotation.
This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.
### Finding IDs
1. Enable Developer Mode: User Settings → Advanced → Developer Mode
2. Right-click server/channel/user → **Copy ID**
## Bot Presence
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# Reset discord state (if applicable)
rm ~/.clawdbot/data/discord-*.json
# Restart to rebuild state
clawdbot gateway restart
The skill describes installation steps, token validation, health checks, and automatic integration actions that imply network access and environment interaction, yet it declares no explicit tool scope or permissions. This weakens user visibility and policy enforcement, increasing the chance that an agent executes networked or environment-modifying actions without informed consent.
The installation section says the skill will automatically install components, update navigation, register handlers, and later notes a build and gateway restart, but it does not present this as a prominent risk warning. Silent or under-disclosed local code modification and service restart can disrupt systems, bypass change-management expectations, and create an opportunity for persistence if the skill is abused.
The skill instructs users to paste a Discord bot token and describes storage options, but it does not provide a strong warning about credential sensitivity, redaction, least exposure, and secure handling. Because bot tokens grant remote control over a Discord bot and often access to multiple servers, weak disclosure around handling can lead to accidental leakage in logs, chat transcripts, config files, or screenshots.
This handler performs two safety-relevant actions: it persists a credential to the config file and schedules a process restart so the new token takes effect. Although the returned message mentions the restart after the fact, there is no prior confirmation prompt or explicit user-facing warning before making these changes.
The post-install hook automatically executes a gateway restart via execSync without explicit prior consent. Automatic service restarts can interrupt active workloads, create denial-of-service conditions for users, and in this skill are more sensitive because the installer also patches core application files and immediately activates those changes.
The uninstall hook deletes files recorded in installContext.installedFiles without any user confirmation or safety check. In a plugin that modifies host application files, this can cause unexpected data loss or break the gateway/UI if the tracked paths are stale, incorrect, or influenced by prior install state.
The troubleshooting guide instructs users to pass a raw Discord bot token directly on the command line, which can expose the credential through shell history, process listings, terminal scrollback, and logging systems. Because this is operational documentation for a live integration, the token is a high-value secret and the lack of handling guidance creates a realistic credential-leak risk.
Resetting a bot token is a sensitive, potentially disruptive action because it invalidates the previous credential and requires secure storage of the new one. The document presents this as a routine fix but does not warn about operational impact or safe handling of the regenerated secret.
The recovery procedure tells users to delete local Discord state files without clearly warning that the action is destructive and may remove cached guild/channel state or other local operational data. In troubleshooting documentation, destructive remediation without backup guidance can cause avoidable data loss or service disruption, especially if copied verbatim under time pressure.
This code builds an Authorization header from the supplied bot token and sends it over HTTP requests to Discord. While the script's health-check purpose implies network access, it does not explicitly warn users that their credential will be transmitted to external endpoints as part of validation.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
removeFile(path.join(gatewayPath, "src/gateway/server-methods/discord-connect.ts"));
removeFile(path.join(uiPath, "src/ui/views/discord.ts"));
// Note: We don't automatically remove patches from server-methods.ts,
// navigation.ts, and app-render.ts as it's safer to do manually
log("");
Detected: suspicious.dangerous_exec