T09 · Insecure Skill Coding Practices
- Location
scripts/slack-standup.sh:7- Finding
Hardcoded Slack Bot Credential in Executable Script
- Content
View full analysis
Vulnerability Details
File Location:
scripts/slack-standup.sh:7-10
Vulnerability Type: Hardcoded credential
Risk Level: Highbash # Configuration SLACK_TOKEN="xoxb-12345678901-1234567890" CHANNEL="#standup" TIME="09:00"Technical Analysis
The executable script embeds a Slack-style bot token directly in source code. Credentials committed to a repository or distributed package are accessible to every person and system that can read the package, including source-control history, build logs, caches, and installed copies.
Although the observed value may be an example or placeholder, the script treats it as an operational credential and sends it in the
Authorizationheader atscripts/slack-standup.sh:15. If the value is valid—or is replaced with a valid token and subsequently committed—no additional authentication barrier prevents its misuse. This also contradicts the warning inreferences/SETUP.md:29not to commit tokens.Attack Path
- An attacker obtains a copy of the repository, package, build artifact, backup, or source-control history.
- The attacker extracts the
xoxb-*value fromscripts/slack-standup.sh. - The attacker submits Slack Web API requests using
Authorization: Bearer <token>. - If the token is valid, Slack accepts requests under the bot identity.
- The attacker can exercise every OAuth scope granted to that bot until the credential is revoked or expires.
Impact Assessment
A valid exposed token permits impersonation of the Slack bot and use of its granted workspace permissions. Under the documented configuration, this may include posting messages, posting to public channels without membership, and enumerating public channels. The precise workspace and data exposure depend on whether the displayed token is valid and which scopes were granted.
- Remediation
View remediation
Remediation Suggestions
- Remove the embedded token and immediately revoke or rotate it if it was ever valid.
- Read the token from a protected environment variable or secrets manager:
bash SLACK_TOKEN="${SLACK_BOT_TOKEN:-}" - Terminate safely when the variable is missing:
bash if [[ -z "$SLACK_TOKEN" ]]; then printf '%s\n' "SLACK_BOT_TOKEN is required" >&2 exit 1 fi - Ensure secrets are never printed in command traces, logs, diagnostics, or Slack API error output.
- Add secret scanning to pre-commit hooks and CI, including detection of Slack
xoxb-*tokens. - Review repository history and distributed artifacts because deleting the current line does not remove historical copies.
- Store production secrets with restricted read permissions and rotate them periodically and after any suspected disclosure.
