bot token
Exposed Discord Bot Token? Here's how to detect and rotate it
Leaked a Discord bot token? Reset it in the Developer Portal in under a minute, then check a few settings. Scan your repo free with Trust for other copies.
A Discord bot token is the single credential that authenticates your bot to Discord, and it carries every permission the bot has been granted. Anyone with the token controls your bot completely - there is no per-request check beyond the token itself. A leaked token means immediate, full bot takeover until you reset it.
What an attacker can do with a leaked Discord Bot Token
- Takes over your bot entirely and acts with all of its server permissions.
- Nukes servers - mass-deleting channels, banning or kicking every member.
- Spams every server the bot is in with scams, malware links, or raid content.
- Reads messages and server data the bot can see, exfiltrating private content.
How Discord Bot Tokens get exposed
- Committed to a public repo in a config, .env, or bot.py/index.js file.
- Hardcoded in a script or Dockerfile shared in a Discord, gist, or forum.
- Exposed in hosting logs, a screenshot, or a pasted error while asking for help.
- Detected by Discord's own scanning, which auto-resets tokens found leaked publicly.
Scan your repo for exposed Discord Bot Tokens - free
Trust checks the files in your repo and the JavaScript your site ships. No signup, results in about a minute.
Run a free scan →How to rotate a leaked Discord Bot Token
- Go to discord.com/developers/applications and open your application.
- Click the Bot tab in the left sidebar.
- Click Reset Token, confirm, and enter your 2FA code if prompted - the old token is invalidated instantly and any running instance disconnects.
- Copy the new token once and store it in your environment or secrets manager, never in code.
- Redeploy or restart your bot with the new token to bring it back online.
- Open each server's Server Settings → Audit Log and review recent actions for bans, deletions, or role changes you did not make.
Open the Discord Bot Token dashboard →
Make the next slip smaller
- Give the bot only the permissions it needs. Avoid the Administrator permission.
- Turn on privileged intents (members, presence, message content) only if your bot really uses them.
- Keep the token in an environment variable on your host, never in a file you commit.
- Use a separate bot for testing, so a test token never touches your real servers.
How Trust helps
Trust's repo scan has a rule for common Discord bot token formats, so it may catch one in your files before you push or share the repo.
Other secret types to check
- SendGrid API KeySG.…
- Mailgun API Keykey-…
- Twilio API Key / Auth TokenSK… / Auth Token
- Database Connection Stringpostgres:// (mysql/mongodb/redis://)
- Private Key (RSA / SSH / EC)-----BEGIN … PRIVATE KEY-----
- JWT Signing SecretHS256 signing secret