Back to skill

Security audit

Telegram Group Onboard

Security checks for vulnerabilities and agentic risk

Overview

This skill is for Telegram group onboarding, but it recommends and defaults to broad group access where any group member can trigger the bot and every message may be processed.

Install only if you intentionally want Telegram group onboarding to make the bot available broadly in groups. Prefer keeping groupPolicy as allowlist, verify the group and administrator, use requireMention=true unless full-channel listening is explicitly approved, and document how to remove the group and project records later.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:17
Finding

Global Open Telegram Group Policy Bypasses Explicit Group Authorization

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 17-31
Vulnerability Type: T05: Unauthorized Access and Privilege Escalation
Risk Level: High

Vulnerable code snippet:

markdown
**Recommended fix:** Set `channels.telegram.groupPolicy: "open"` at the top level. This is safe when `dmPolicy: "pairing"` is active - strangers can't DM the bot without pairing first, and they can only interact in groups they're already a member of. With `groupPolicy: "open"`, new groups work immediately without manual allowlisting.

```json5
{
  "channels": {
    "telegram": {
      "dmPolicy": "pairing",        // strangers must pair first
      "groupPolicy": "open",        // groups work automatically
      // ...
    }
  }
}
text

### Technical Analysis

The skill recommends setting the top-level Telegram `groupPolicy` to `open` and claims that this is safe when direct-message pairing is enabled. Direct-message authorization and group authorization are separate trust boundaries: `dmPolicy: "pairing"` restricts direct conversations but does not authorize or restrict group interactions.

A globally open group policy removes the explicit allowlist requirement for existing and future Telegram groups. The skill documentation further indicates that an open policy permits any group member to trigger the bot. Consequently, direct-message pairing does not compensate for the loss of group-level authorization.

This recommendation conflicts with least-privilege principles because access is granted to all groups rather than only to a group whose identity and ownership have been explicitly verified.

### Attack Path

1. An administrator applies the documented recommendation and sets the top-level `groupPolicy` to `open`.
2. An attacker adds the bot to a Telegram group or interacts from an existing group containing the bot.
3. The attacker sends instructions to the bot without obtaining direct-message pairing or
...[truncated 788 chars]
Remediation
View remediation

Remediation Suggestions

  • Retain channels.telegram.groupPolicy: "allowlist" as the secure default.
  • Require explicit owner or administrator approval for each Telegram chat ID before adding it to the configuration.
  • Verify the group identity and expected administrator before changing authorization.
  • Clearly document that dmPolicy: "pairing" governs direct messages only and does not secure group interactions.
  • Default each group to requireMention: true, requiring an explicit, informed decision before enabling responses to every message.
  • Apply least-privilege controls to tools available through group conversations, even for allowlisted groups.
  • Record and audit group authorization changes, including the approving identity, chat ID, and time of approval.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/add-telegram-group.sh:7
Finding

Permissive Defaults and Missing Validation Permit Unsafe Telegram Configuration

Content
View full analysis

Vulnerability Details

File Location: scripts/add-telegram-group.sh, lines 7-10 and 38-45
Vulnerability Type: T09: Insecure Skill Coding Practices
Risk Level: Medium

Vulnerable code snippets:

bash
set -euo pipefail

CHAT_ID="${1:?Usage: add-telegram-group.sh <chat_id> [requireMention] [groupPolicy]}"
REQUIRE_MENTION="${2:-false}"
GROUP_POLICY="${3:-open}"
bash
jq --arg id "$CHAT_ID" \
   --argjson mention "$REQUIRE_MENTION" \
   --arg policy "$GROUP_POLICY" \
   '.channels.telegram.groups[$id] = {
      requireMention: $mention,
      groupPolicy: $policy
    }' "$CONFIG" > "${CONFIG}.tmp" && mv "${CONFIG}.tmp" "$CONFIG"

Technical Analysis

The script defaults to requireMention=false and groupPolicy=open. Thus, an invocation that supplies only a chat ID creates a group configuration in which every message can trigger the bot and any group member can interact with it.

The script also does not validate that:

  • CHAT_ID is a negative Telegram group or supergroup integer.
  • REQUIRE_MENTION is exactly true or false.
  • GROUP_POLICY is one of the supported authorization policies, such as open or allowlist.

Quoting and use of jq --arg mitigate direct shell and jq expression injection through these parameters. However, unchecked values can still introduce unsupported configuration semantics, cause jq --argjson to fail, or weaken authorization through accidental or attacker-influenced arguments. The generated configuration is moved into place without a separate application-level validation step.

Attack Path

  1. An operator invokes the script with only a chat ID, follows the documented example, or uses parameters influenced by an untrusted source.
  2. The omitted optional arguments automatically become false and open.
  3. The script writes a configuration that allows every group message to invoke the bot.
  4. Any member of ...[truncated 854 chars]
Remediation
View remediation

Remediation Suggestions

  • Change the defaults to requireMention=true and groupPolicy=allowlist.
  • Require an explicit confirmation or dedicated flag before applying requireMention=false or groupPolicy=open.
  • Validate the chat ID before accessing or modifying the configuration:
bash
if [[ ! "$CHAT_ID" =~ ^-[0-9]+$ ]]; then
  echo "ERROR: chat_id must be a negative integer" >&2
  exit 1
fi
  • Restrict the Boolean argument to its supported values:
bash
case "$REQUIRE_MENTION" in
  true|false) ;;
  *) echo "ERROR: requireMention must be true or false" >&2; exit 1 ;;
esac
  • Restrict the policy argument to an explicit allowlist:
bash
case "$GROUP_POLICY" in
  open|allowlist) ;;
  *) echo "ERROR: unsupported groupPolicy" >&2; exit 1 ;;
esac
  • Generate the updated configuration in a securely created temporary file located in the same directory as the destination.
  • Validate both JSON syntax and OpenClaw configuration semantics before replacing the active file.
  • Preserve the original file's ownership and permissions and clean up temporary files through a shell trap.
  • Log the authorization change and require explicit administrator approval for the target chat ID.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description promises an automated end-to-end onboarding workflow for new Telegram groups, including log monitoring, chat_id discovery, config updates tailored to the allowlist problem, project creation, and hot-reload. The supplied code only implements a narrow subset: manually adding a specified chat_id to the Telegram groups section of the config file. It neither monitors logs nor creates projects nor reloads the service automatically. Its behavior is materially narrower and operationally different from the declared purpose, so this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest description says to use the skill when 'the bot was added to a new group but doesn't respond' or when 'someone reports the bot ignores messages in a group,' which are broad troubleshooting situations rather than narrowly scoped invocation phrases. Without explicit exclusions or tighter constraints, this could overlap with many ordinary support conversations and cause unintended activation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the operator to set requireMention=false and groupPolicy=open, which causes the bot to respond to all group messages, but it does not prominently warn about the resulting expansion in exposure. In context, this weakens group interaction safeguards and can lead to accidental over-collection of group content, unsolicited bot responses, and wider prompt injection exposure from any group member.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

Creating persistent project artifacts and adding entries to PROJECTS.md based on a Telegram group chat_id introduces durable state tied to an externally sourced identifier. In this context, automatic or insufficiently verified persistence can accumulate unauthorized group records, retain metadata longer than intended, and make accidental onboarding harder to reverse.

Content

Scanner excerpt · SKILL.md (reported line 105)May include surrounding context.

md
3. Create `projects/<chat_id>/glossary.md` (empty)

4. Add entry to `PROJECTS.md` table

5. For remote servers, create these files via SSH or scp.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The confirmation text sent to users is written in German, and the skill does not indicate that German is optional, configurable, or required for a region-specific deployment. This creates a language policy issue because the skill implicitly forces a locale on end users without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.