T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- references/authentication.md:19
- Finding
- Automatic Extraction and Plaintext Storage of All Slack Workspace Session Credentials<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:24-40`; `references/authentication.md:19-27, 145-150` **Vulnerability Type**: Excessive credential access and insecure credential storage **Risk Level**: High ### Vulnerable Code From `SKILL.md:24-40`: ```markdown # Get workspace snapshot (credentials are extracted automatically) agent-slack snapshot # Send a message agent-slack message send general "Hello from AI agent!" # List channels agent-slack channel list ``` ```markdown Credentials are extracted automatically from the Slack 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 Slack's stored token). This is a one-time prompt. **IMPORTANT**: NEVER guide the user to open a web browser, use DevTools, or manually copy tokens from a browser. Always use `agent-slack auth extract` to obtain tokens from the desktop app. ``` From `references/authentication.md:19-27`: ```markdown This command: 1. Detects your operating system (macOS, Linux, Windows) 2. Locates the Slack desktop app data directory (supports both direct download and App Store versions on macOS) 3. Reads the LevelDB storage containing session data 4. Decrypts cookies using macOS Keychain (for sandboxed App Store version) 5. Validates tokens against Slack API before saving 6. Extracts xoxc token and xoxd cookie for ALL logged-in workspaces 7. Stores credentials securely in `~/.config/agent-messenger/slack-credentials.json` ``` From `references/authentication.md:145-150`: ```markdown ### Security - File permissions: `0600` (owner read/write only) - Tokens are stored in plaintext (same as Slack desktop app) - Keep this file secure - it grants full access to your Slack workspaces ``` ### Technical Analysis The documented authentication flow reads Slack desktop application storage, decrypts session cookies thro ...[truncated 2626 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace desktop-session extraction with Slack's supported OAuth authorization flow. 2. Request only the minimum OAuth scopes required for the requested operation. 3. Require explicit user consent before authenticating and clearly identify the workspace and scopes involved. 4. Authenticate only the workspace selected by the user rather than every logged-in workspace. 5. Do not extract or persist `xoxd` browser session cookies. 6. Store refresh tokens or access tokens in an operating-system credential manager such as macOS Keychain, Windows Credential Manager, or Secret Service on Linux. 7. If file-based storage is unavoidable, encrypt credentials with a key held outside the file, retain `0600` permissions, and prevent inclusion in backups and version control. 8. Add commands for credential inventory, expiration, revocation, and per-workspace deletion. 9. Ensure debug output never contains tokens, cookies, authorization headers, or credential-bearing API responses. 10. Subject the external package that performs extraction to a separate source-code and supply-chain audit. ]]>
