T05 · Unauthorized Access and Privilege Escalation
- Location
references/authentication.md:19- Finding
Automatic extraction of a full-account Discord user token
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Discord skill is disclosed as a messaging integration, but it relies on automatic full-account Discord user-token extraction, plaintext credential storage, broad account access, and inconsistent install guidance that users should review carefully.
Install only if you are comfortable giving this tool access equivalent to your Discord account, including reading private channels you can access and sending messages as you. Avoid the template instruction to install `agent-discord`; use only the documented `agent-messenger` package path after verifying provenance. Do not grant Terminal Full Disk Access for this skill unless you fully understand that other terminal-launched processes may inherit broader file access. Treat the credentials file, memory file, and saved snapshots as sensitive and remove them when no longer needed.
references/authentication.md:19Automatic extraction of a full-account Discord user token
references/authentication.md:98Full-account Discord token stored in plaintext at a predictable path
references/authentication.md:212Troubleshooting guidance requests terminal-wide Full Disk Access
SKILL.md:58Persistent Agent memory accepts remote and user-influenced Discord metadata
templates/monitor-channel.sh:127Templates recommend installing the explicitly identified wrong package
templates/server-summary.sh:164Comprehensive Discord snapshots are saved without restrictive permissions or explicit consent
The description is broadly about Discord interaction, including sending messages, reading channels, and managing reactions. The supplied code specifically implements a channel-monitoring utility: it repeatedly calls agent-discord message list on one channel, tracks the most recent message ID, and prints newly detected messages. That means the actual primary behavior is continuous monitoring/read access to channel messages, which is more specific than the declared description and introduces a persistent polling/monitoring behavior not clearly stated. Additionally, the declared capabilities to send messages and manage reactions are not actually exercised by this code; sending is only shown in commented example code and reactions are absent entirely. This is therefore a description/behavior mismatch, mainly because the code's concrete purpose is active monitoring rather than general Discord interaction.
The declared description suggests an interactive Discord skill focused on operational actions like sending messages, reading channels, and managing reactions. The supplied code instead is a reporting/export utility: it validates auth/server context, calls agent-discord snapshot, parses the returned data, displays a server summary, and persists the full snapshot locally. While it does read Discord server data, its primary purpose is server summarization and local export, not interactive server management. It also does not implement reaction management or actual message sending—those appear only as printed example commands. This is a material description/behavior mismatch.
The skill explicitly documents local storage of a Discord user token in a credentials file, which represents direct access to account credentials. Even with 0600 permissions, local plaintext token storage substantially increases compromise impact from local malware, shared environments, backups, or accidental disclosure.
Credentials stored in: ~/.config/agent-messenger/discord-credentials.json
Format:
The documented use of macOS Keychain access to decrypt Discord's stored token indicates the skill is designed to retrieve protected credentials from local application storage. This is powerful credential-access behavior that can enable full Discord account takeover or impersonation if mishandled, especially because it is framed as a normal troubleshooting/auth step.
Common causes:
- Discord desktop app is not installed or not logged in
- macOS Keychain access was denied (re-run and approve the prompt)
- Discord is not running and LevelDB files are stale
### `agent-discord: command not found`
The guide explicitly instructs users to extract a Discord user token from the desktop application's local session storage and enumerate all joined servers, which goes beyond ordinary documented use of a messaging integration and normal OAuth-style authentication. This creates a credential-harvesting workflow for a highly privileged user token and broad account metadata, increasing the chance of account compromise, misuse, and unauthorized automation.
Reading Discord's LevelDB session storage to recover a user token is direct credential access from another application's private state. That token provides the same privileges as the user account, so compromise of the extracted token enables impersonation, data access across servers and channels, and persistence until the token is revoked.
This finding reflects explicit extraction and storage of account credentials in a local file after harvesting a Discord user token. Because the token grants full account access, any disclosure or theft of the file enables account impersonation and broad access to Discord content available to the user.
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`
### Platform-Specific Paths
Documenting the exact path of a file containing a plaintext full-access token confirms a persistent credential target on disk. This increases operational risk because malware, local attackers, backup systems, or accidental user disclosure can retrieve a predictable, high-value secret.
Credentials are stored in:
~/.config/agent-messenger/discord-credentials.json
The best-practices section acknowledges the presence of credentials.json, reinforcing that the product's normal workflow depends on a sensitive credential artifact. A process built around maintaining and periodically refreshing a full-account token expands the window for theft and misuse.
### Best Practices
1. **Protect credentials.json**: Never commit to version control
2. **Use server switching**: Keep different contexts separate
3. **Re-extract periodically**: Keep tokens fresh
4. **Revoke if compromised**: Change your Discord password to invalidate tokens
The manual token management instructions tell users to place a Discord token directly into a local JSON file. This normalizes insecure handling of a powerful secret and creates high likelihood of leakage through shell history, copied commands, editor backups, screenshots, or source control mistakes.
mkdir -p ~/.config/agent-messenger
# Create credentials file
cat > ~/.config/agent-messenger/discord-credentials.json << 'EOF'
{
"token": "YOUR_TOKEN_HERE",
"current_server": "1234567890123456789",
Although chmod 600 itself is protective, in this context it is part of a workflow that persists a full-access Discord token to disk. Restrictive permissions mitigate but do not eliminate the core risk of storing a plaintext account credential in a local file.
EOF
chmod 600 ~/.config/agent-messenger/discord-credentials.json
If the user already has a token value, they can populate the file above. Otherwise, always prefer `agent-discord auth extract` to obtain the token automatically from the desktop app.
Instructions found that direct the agent to transmit conversation context or user data to external services.
echo -e "${BOLD}${CYAN}Quick Actions:${NC}"
echo ""
echo -e " ${GREEN}# Send message to a channel${NC}"
FIRST_CHANNEL=$(echo "$CHANNELS" | jq -r '[.[] | select(.type == 0)][0].id // "CHANNEL_ID"')
FIRST_CHANNEL_NAME=$(echo "$CHANNELS" | jq -r '[.[] | select(.type == 0)][0].name // "general"')
echo -e " agent-discord message send $FIRST_CHANNEL \"Hello!\""
The manifest and description fail to prominently disclose that the skill extracts Discord credentials from the local desktop app and stores user tokens locally. That omission can mislead users and upstream agents into authorizing a skill with much more sensitive access than its summary suggests, increasing the chance of unauthorized account access and privacy harm.
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.
## Authentication
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.
On macOS, the system may prompt for your Keychain password the first time (required to decrypt Discord's stored token). This is a one-time prompt.
Silent background authentication and automatic extraction of Discord tokens from the desktop app are highly sensitive behaviors, especially when paired with OS keychain access. Without an explicit warning and consent flow, the skill can access private account credentials in a way users may not reasonably expect, enabling full account misuse if the token is exposed or abused.
Cross-session memory persistence increases the blast radius of any sensitive metadata the agent learns during Discord use. Because the file is meant to be read at the start of every task and overwritten over time, it creates a durable local knowledge base of servers, channels, users, and preferences that may be exposed outside the original task context.
## Memory
The agent maintains a `~/.config/agent-messenger/MEMORY.md` file as persistent memory across sessions. This is agent-managed — the CLI does not read or write this file. Use the `Read` and `Write` tools to manage your memory file.
### Reading Memory
The skill instructs agents to persist server IDs, channel IDs, user IDs, and preferences across sessions without a strong warning that this metadata may be sensitive. Even if tokens are excluded, persistent retention of communication structure and user associations can expose private organizational information or social graphs.
Persisting identifiers, aliases, preferences, and channel structure across sessions creates durable tracking of users and organizations beyond the immediate task. If the memory file is later accessed by another agent, user, or process, it can reveal sensitive operational context and relationship mapping.
The manifest understates the breadth of account and metadata access, while the documented commands expose member lists, DMs, friends, mentions, notes, profiles, files, and server snapshots. Users or orchestrators relying on the short description may grant this skill broader surveillance and data-access capabilities than intended.
The guide presents token extraction and server discovery as the simplest authentication path without an upfront warning that it accesses private session storage and yields full-account credentials. Users may proceed without understanding the security, privacy, and policy implications, which undermines informed consent for a sensitive operation.
The documentation states that a plaintext Discord user token is stored locally and that it grants full account access. Plaintext storage of a high-value credential materially increases exposure to local compromise, accidental disclosure, backup leakage, malware theft, or unsafe debugging and support workflows.
The guide explicitly states that tokens are stored in plaintext and grant full access to the Discord account, which creates persistent session material on disk. Persistent high-privilege sessions increase exposure to local theft, long-lived compromise, and delayed detection compared with ephemeral or scoped tokens.
### Security
- File permissions: `0600` (owner read/write only)
- Tokens are stored in plaintext (same as Discord desktop app)
- Keep this file secure - it grants full access to your Discord account
The debug-mode guidance encourages detailed troubleshooting output around token extraction and validation but does not warn that logs may expose tokens, account identifiers, server metadata, or filesystem locations. Sensitive debugging output is a common source of credential leakage in terminals, CI logs, screen sharing, and support tickets.
The documented capability set includes file transfer, user information access, and member-list visibility beyond the narrow manifest description of sending messages, reading channels, and managing reactions. That discrepancy matters because it signals a broader access envelope than users may expect, increasing privacy and misuse risk if the skill is trusted based on the manifest alone.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
EOF
chmod 600 ~/.config/agent-messenger/discord-credentials.json
If the user already has a token value, they can populate the file above. Otherwise, always prefer `agent-discord auth extract` to obtain the token automatically from the desktop app.