Back to skill

Security audit

Telethon Master

Security checks for vulnerabilities and agentic risk

Overview

The skill is transparent about being a Telegram account bridge, but it grants broad private-chat access and account-changing powers with weak scoping around reads and destructive actions.

Install only if you are comfortable giving the agent broad access to the Telegram account behind the Telethon session. Prefer a dedicated Telegram account, verify that the bridge enforces read and write allowlists in code, require explicit confirmation before deletes, joins, forwards, media downloads, and channel changes, never display the .env contents, and avoid converting private or sensitive text through ElevenLabs TTS.

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:47
Finding

Telegram Read Operations Bypass the Configured Chat Allowlist

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 47–57
Vulnerability Type: Incomplete authorization enforcement and excessive account access
Risk Level: High

Relevant snippet translated into English from the documentation:

markdown
The MCP server supports the `TG_ALLOWED_CHAT_IDS` variable—a comma-separated
list of permitted chat IDs. If the variable is set, write operations
(send, edit, delete, forward, react, click, file, voice, pin, read, audio,
circle, channel about/delete, join) are permitted only for the specified chats.

Configuration in `mcp.json`:
```json
"env": {
    "TELEGATEWAY_URL": "http://127.0.0.1:18792",
    "TG_ALLOWED_CHAT_IDS": "me,1144466778,kngserious55"
}

Read operations (messages, chats, search, stats, get_chat, get_photo, get_chatlist, download_media) are not restricted.

text

### Technical Analysis

The documented `TG_ALLOWED_CHAT_IDS` security boundary applies only to operations classified as writes. Read-oriented tools remain authorized for every conversation available to the underlying Telegram user session.

Consequently, a Skill invocation can use `telegram_chats` to enumerate the account’s conversations and then invoke `telegram_messages`, `telegram_search`, `telegram_get_chat`, `telegram_get_photo`, or `telegram_download_media` against chats that were deliberately omitted from the allowlist. This violates least privilege because access to unrestricted account history is not necessary when the user has configured a specific set of permitted chats.

`SKILL.md` line 249 separately states that private messages must not be read without the account owner’s explicit permission. However, this is a prose restriction rather than a documented technical control. Agent compliance alone does not provide a dependable authorization boundary.

The package contains documentation only, so the external bridge implementation could not be inspected to verify whether it ha
...[truncated 1634 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce TG_ALLOWED_CHAT_IDS for every operation that accepts or resolves a chat identifier, including all read, metadata, statistics, and media-download operations.
  2. Filter telegram_chats results so non-allowlisted dialogs cannot be enumerated.
  3. Use deny-by-default behavior when the allowlist is absent. Require an explicit configuration option if unrestricted account access is genuinely needed.
  4. Resolve usernames and aliases to canonical Telegram identifiers before authorization checks to prevent identifier-format bypasses.
  5. Apply authorization checks after redirects, invite resolution, forwarded-message resolution, and other indirect chat lookups.
  6. Separate read and write permissions, such as TG_READ_ALLOWED_CHAT_IDS and TG_WRITE_ALLOWED_CHAT_IDS, while requiring both to be explicitly configured.
  7. Require explicit confirmation before accessing a private conversation or downloading media.
  8. Add automated tests proving that every tool rejects non-allowlisted chats and that dialog enumeration cannot reveal them.
  9. Avoid logging message bodies, downloaded media contents, or sensitive chat metadata when authorization fails.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:258
Finding

Troubleshooting Instructions Encourage Access to a Secret-Bearing Environment File

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 166 and 258–260
Vulnerability Type: Unsafe credential-handling guidance
Risk Level: Medium

Relevant snippets translated into English from the documentation:

markdown
| `sag: missing API key` | `ELEVENLABS_API_KEY` is not set | Check the bridge `.env` |
markdown
- Bridge `.env`: `~/.openclaw/workspace/general/telethon-bridge/.env`
- ElevenLabs voices: `ELEVENLABS_API_KEY` in `.env` → `https://api.elevenlabs.io/v1/voices`

Technical Analysis

The Skill identifies the exact location of a credential-bearing .env file and recommends checking that file when the ElevenLabs API key is unavailable. An agent following this troubleshooting instruction may read or display the entire file rather than performing a non-disclosing presence check.

Environment files commonly contain multiple credentials, tokens, endpoints, and configuration values. Once displayed through a file-reading tool, these values can enter model context, conversation transcripts, diagnostic logs, or monitoring systems. The documented behavior therefore exceeds the minimum privilege required to diagnose whether ELEVENLABS_API_KEY is configured.

No instruction to transmit the key to an external party was found, and the audited package contains no executable code that performs credential exfiltration. The risk is accidental disclosure caused by unsafe operational guidance rather than confirmed malicious extraction.

Attack Path

  1. A user invokes telegram_voice, and the bridge reports that the ElevenLabs API key is missing or unavailable.
  2. The agent follows the documented instruction to check the bridge’s .env file.
  3. It opens ~/.openclaw/workspace/general/telethon-bridge/.env with a file-reading or shell tool.
  4. The complete contents, including ELEVENLABS_API_KEY and potentially unrelated secrets, are returned in tool output.
  5. Those secrets become pa ...[truncated 679 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace “check the .env file” with a presence-only diagnostic that never prints the value, for example:
    bash
    if [ -n "${ELEVENLABS_API_KEY:-}" ]; then
      printf '%s\n' 'ELEVENLABS_API_KEY is configured'
    else
      printf '%s\n' 'ELEVENLABS_API_KEY is not configured'
    fi
    
  2. Explicitly instruct agents never to display, copy, summarize, or log .env contents.
  3. Store production credentials in a dedicated secret manager or protected service environment rather than a workspace file.
  4. Restrict credential-file permissions to the bridge service account, such as owner read access only.
  5. Separate unrelated service credentials so compromise of one configuration source does not expose multiple systems.
  6. Redact values matching API-key and token patterns from tool output, bridge logs, error messages, and audit records.
  7. Provide a bridge health endpoint that reports whether required credentials are configured without returning their values.
  8. Rotate any credential that has previously been printed in agent output or troubleshooting logs.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill exposes destructive and privacy-impacting operations such as deleting messages, joining chats, downloading media, changing channel metadata, and deleting channels, but it does not require explicit confirmation or emphasize approval boundaries at the point of use. In an agent setting, this can enable accidental account actions, privacy violations, or irreversible destructive changes if the model invokes tools based on ambiguous user prompts.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

The skill documents transmission of user-provided text to ElevenLabs via the sag CLI for TTS generation, which sends content to an external third-party service. This creates a real data exfiltration and privacy risk if messages, sensitive text, or personal data are converted to voice without explicit user awareness and consent.

Content

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

md
- Gateway Bridge: `~/.openclaw/workspace/general/telethon-bridge/gateway.mjs`
- `.env` бриджа: `~/.openclaw/workspace/general/telethon-bridge/.env`
- Systemd unit: `~/.config/systemd/user/telethon-bridge.service`
- ElevenLabs голоса: `ELEVENLABS_API_KEY` в `.env` → `https://api.elevenlabs.io/v1/voices`
- sag CLI: `/home/linuxbrew/.linuxbrew/bin/sag speak --help`
- Формат voice note: OGG Opus, 48000 Hz, mono, 192k

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

All user-facing instructions and operational guidance in the skill description are presented only in Russian, with no indication that the user may choose another language or that the skill is intentionally region- or locale-specific. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.