Back to skill

Security audit

Telegram Topic Rename

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims, but it changes Telegram forum topics using a bot token and handles that credential in a way users should review before installing.

Review this before installing if the bot has admin rights in Telegram groups. Use a least-privilege Telegram bot token, confirm the exact chat, thread, name, and icon before running it, and be aware that the current script can expose the token to local process observers or command-line logging while curl runs.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/rename-topic.sh:202
Finding

Telegram Bot Token Exposed in Process Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/rename-topic.sh, lines 202–227
Vulnerability Type: Credential exposure through process arguments
Risk Level: Medium

bash
CURL_ARGS=(-s "https://api.telegram.org/bot${BOT_TOKEN}/editForumTopic")
CURL_ARGS+=(-d "chat_id=${CHAT_ID}")
CURL_ARGS+=(-d "message_thread_id=${THREAD_ID}")
CURL_ARGS+=(--data-urlencode "name=${NAME}")

# Add icon if provided
if [ -n "$ICON" ]; then
  # Check if it's a 19-digit ID
  if [[ "$ICON" =~ ^[0-9]{19}$ ]]; then
    ICON_ID="$ICON"
  elif [ -n "${ICON_MAP[$ICON]}" ]; then
    ICON_ID="${ICON_MAP[$ICON]}"
  else
    echo "Warning: Icon '$ICON' not found, skipping icon change"
    echo "警告:图标 '$ICON' 未找到,跳过图标更换"
    ICON_ID=""
  fi
  
  if [ -n "$ICON_ID" ]; then
    CURL_ARGS+=(-d "icon_custom_emoji_id=${ICON_ID}")
    echo "Using icon ID / 使用图标 ID: $ICON_ID"
  fi
fi

# Execute
curl "${CURL_ARGS[@]}" | jq .

Technical Analysis

The Telegram bot token is interpolated directly into the Bot API URL stored in CURL_ARGS. When curl is launched, this URL becomes part of the child process's command-line argument vector.

Depending on operating-system hardening and process-monitoring configuration, command-line arguments may be observable through process listings, /proc interfaces, audit systems, endpoint monitoring, diagnostic tooling, or process telemetry. An authorized local user or monitoring service capable of viewing the curl process arguments could therefore recover the complete bot token.

The request is sent to Telegram's declared official API endpoint over HTTPS, so this is not an unauthorized outbound exfiltration channel. The weakness is the local exposure of the credential before and during request execution.

Attack Path

  1. A legitimate user runs scripts/rename-topic.sh with TELEGRAM_BOT_TOKEN configured.
  2. The script constructs a URL containing the token: https://api.telegram.org/bot<token>/editForumTopic.
  3. The shell launche ...[truncated 1157 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not place the bot token in a child process's command-line arguments.
  • Supply the sensitive URL through a protected mechanism that does not expose it in the normal process argument vector, such as a curl configuration delivered through standard input or a restricted file descriptor.
  • Ensure any temporary credential-bearing configuration is created with restrictive permissions, is not written to a shared directory, and is securely removed immediately after use.
  • Disable or redact command-line capture for this invocation in audit, tracing, shell-debugging, and endpoint-monitoring systems.
  • Restrict local process visibility where supported, such as by applying appropriate /proc mount protections and least-privilege execution controls.
  • Run the script under a dedicated account with only the access necessary for its task.
  • Rotate the Telegram bot token if process telemetry, logs, or monitoring systems may already have captured it.
  • Review and minimize the bot's Telegram administrator permissions to reduce the impact of future credential compromise.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises shell-based execution (scripts/rename-topic.sh) but does not declare any tool scope or allowed-tools restrictions. This creates an authorization gap where an agent may invoke shell access more broadly than users or platform policy expect, increasing the chance of unintended command execution or misuse of the Telegram bot token.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description contains broad triggers like 'name/rename a topic' and common Chinese phrases that could match ordinary conversation and cause the skill to activate unexpectedly. In a skill that performs external state-changing API calls, overbroad invocation language raises the risk of unintended topic renames or icon changes without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation instructs use of TELEGRAM_BOT_TOKEN and sending chat/thread metadata to the Telegram Bot API but does not explicitly warn users that this is an external transmission using privileged credentials. That omission can prevent informed consent and may lead users to expose sensitive group metadata or authorize changes they did not realize were being performed through a bot account.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/rename-topic.sh (reported line 201)May include surrounding context.

sh
echo "警告:名称 $CHAR_COUNT 字符,超过 10 字符限制"
fi

# Build curl arguments
CURL_ARGS=(-s "https://api.telegram.org/bot${BOT_TOKEN}/editForumTopic")
CURL_ARGS+=(-d "chat_id=${CHAT_ID}")
CURL_ARGS+=(-d "message_thread_id=${THREAD_ID}")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/rename-topic.sh (reported line 202)May include surrounding context.

sh
fi

# Build curl arguments
CURL_ARGS=(-s "https://api.telegram.org/bot${BOT_TOKEN}/editForumTopic")
CURL_ARGS+=(-d "chat_id=${CHAT_ID}")
CURL_ARGS+=(-d "message_thread_id=${THREAD_ID}")
CURL_ARGS+=(--data-urlencode "name=${NAME}")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The document presents the skill name, setup, and usage in both English and Chinese and includes Chinese trigger examples, but it does not state whether language selection is user-driven. If the organization requires user choice for language or locale behavior, this could be a natural-language policy issue because the skill implies a preset bilingual locale mode rather than explicit opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The document consistently presents content in both English and Chinese, including the title and usage instruction, but does not indicate whether this bilingual format is optional or tied to a justified region-specific requirement. Under the policy rule, a fixed language/locale presentation without user opt-in can be considered a natural-language policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The script requires and reads TELEGRAM_BOT_TOKEN, which is a sensitive credential, but the only messaging is operational setup text rather than a clear warning that the skill uses bot credentials to authenticate requests. Under the code-file criteria, sensitive environment variable access should have some explicit disclosure to the user.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.