T05 · Unauthorized Access and Privilege Escalation
- Location
- references/authentication.md:19
- Finding
- Automatic extraction of a full-account Discord user token<![CDATA[ ## Vulnerability Details **File Location**: `references/authentication.md:19-27` **Additional Locations**: `SKILL.md:19-40`, `SKILL.md:137-139`, `references/authentication.md:237-246` **Vulnerability Type**: Credential extraction with excessive account-level authority **Risk Level**: High ### Vulnerable Code ```markdown This command: 1. Detects your operating system (macOS, Linux, Windows) 2. Locates the Discord desktop app data directory 3. Reads the LevelDB storage containing session data 4. Extracts user token 5. Validates token against Discord API before saving 6. Discovers ALL joined servers 7. Stores credentials securely in `~/.config/agent-messenger/discord-credentials.json` ``` The primary instructions also state: ```markdown Credentials are extracted automatically from the Discord desktop app on first use. No manual setup required — just run any command and authentication happens silently in the background. ``` ### Technical Analysis The Skill instructs a third-party CLI to access Discord Desktop's local session storage and extract a user authentication token. This is not a narrowly scoped OAuth or bot-token authorization flow. The extracted token inherits the user's Discord permissions and can be used to act as the user. The extraction may happen automatically when an ordinary command is run. Consequently, a request such as listing channels can trigger access to protected desktop session data without a separate, explicit authorization operation. The authentication guide confirms that the resulting credentials permit the CLI to read accessible channels, send messages, upload files, manage reactions, enumerate members, and access user information. ### Attack Path 1. The Skill installs or invokes the `agent-discord` CLI supplied by the `agent-messenger` package. 2. The user runs a routine command such as `agent-discord snapshot`. 3. The CLI locates Discord Desktop's LevelDB session storage. 4. It extracts and validates the user's D ...[truncated 941 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove all extraction of user tokens from Discord Desktop storage. - Replace user-token authentication with Discord's supported OAuth2 or bot-token authorization flow. - Request only the minimum scopes and server permissions necessary for each operation. - Require explicit, informed authorization before authentication occurs. - Separate read-only and write-capable authorization profiles. - Require confirmation before sending or deleting messages, uploading files, broadcasting, or accessing broad snapshots. - Clearly identify the account, server, channel, and intended operation before any side effect. - Provide immediate credential revocation and session-expiration mechanisms. - Do not use user-account automation where it may violate Discord's terms or platform security model. ]]>
