Back to skill

Security audit

Telegram CS Agent

Security checks for vulnerabilities and agentic risk

Overview

This skill builds a real-account Telegram support bot, but it can read and reply to all messages visible to that account and send them to an external AI service without clear scoping or consent.

Install only for a dedicated Telegram account used solely for customer support. Add a deny-by-default chat allowlist, disclose AI and human-support processing to users, validate or remove custom AI base URLs, protect and rotate the Telethon session, use non-echoing secret prompts, and pin dependencies before production use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/telegram_client.py:78
Finding

Account-Wide Telegram Message Interception and External Processing

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/config.py:11
Finding

Configurable AI Base URL Can Redirect API Credentials and Conversation Data

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/telegram_client.py:19
Finding

Telegram Verification Code and 2FA Password Are Entered with Terminal Echo

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/requirements.txt:1
Finding

Unpinned Third-Party Dependencies Permit Unreviewed Package Upgrades

Content
View full analysis
=0.42.0 chromadb>=0.5.0 sentence-transformers>=3.0.0 python-dotenv>=1.0.0 telethon>=1.37.0 ``` The installation instructions are even less constrained: ```bash mkdir -p ~/tg-cs-bot && cd ~/tg-cs-bot cp -r /scripts/*.py . pip install anthropic chromadb sentence-transformers python-dotenv telethon ``` ### Technical Analysis All declared dependencies use lower-bound constraints rather than exact audited versions, and the documented installation command specifies no versions at all. There is no lockfile, package hash verification, or trusted-index configuration. Consequently, two installations performed at different times can resolve different package versions and transitive dependency trees. Any future release satisfying the lower-bound constraint can be installed automatically without source review or compatibility testing. No evidence was found that the named packages are currently malicious or typosquatted. The vulnerability is the lack of deterministic, integrity-verified dependency resolution in an application that handles high-value Telegram sessions, API credentials, and private messages. ### Attack Path 1. A dependency or transitive dependency publishes a compromised release, or its distribution account is taken over. 2. The compromised version still satisfies the broad `>=` requirement. 3. An operator follows the setup instructions or rebuilds the environment. 4. `pip` resolves and installs the compromised compatible release. 5. Package installation hooks or imported package code execute with the bot process's privileges. 6. Malicious package code reads accessible environment variables, Telegram session files, knowledge documents, or message data. 7. The stolen information can then be t ...[truncated 870 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Rogue AgentSelf-Modification, Session Persistence
Findings (24)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
├── agent.py             # Claude RAG agent
├── knowledge.py         # ChromaDB knowledge base
├── telegram_client.py   # Telethon wrapper
├── .env                 # Secrets (not committed)
├── docs/                # Knowledge base markdown files
│   ├── platform.md
│   ├── faq.md

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/agent.py (reported line 59)May include surrounding context.

python
await tg.send(chat_id, (
                "🤖 Customer Service Bot\n\n"
                "Ask me anything about our project.\n"
                "/clear - Clear conversation history\n"
                "/human - Request human support\n"
                "/help - Show this message"
            ))

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/main.py (reported line 51)May include surrounding context.

python
await tg.send(chat_id, (
                "🤖 Customer Service Bot\n\n"
                "Ask me anything about our project.\n"
                "/clear - Clear conversation history\n"
                "/human - Request human support\n"
                "/help - Show this message"
            ))

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill instructs the user to create files, install packages, copy scripts, and run Python code, but it declares no tool scope or permission boundaries. In an agent ecosystem, this can cause the skill to be invoked with broader-than-expected access to shell, files, and environment secrets, increasing the chance of unintended execution or data exposure.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include broad terms like "telegram bot" and "knowledge base," which are common across many unrelated tasks. Overbroad activation can cause the wrong skill to run in inappropriate contexts, leading to accidental handling of credentials, shell actions, or deployment steps when the user did not intend to invoke this skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill describes using a Telethon userbot that logs in as a real user account, but it does not prominently warn about the security, privacy, and policy risks of handling Telegram API credentials and persistent user sessions. Because the bot impersonates a real account rather than using the Bot API, compromise or misuse could expose private messages, contacts, account metadata, and enable unauthorized messaging.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The setup and login flow creates a persistent Telethon session on disk for a real Telegram account, and the skill does not specify storage protections, rotation, or cleanup. Persistent sessions materially increase risk because anyone with access to the session file can often reuse it to access the account without re-authenticating.

Content

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

Setup New Bot

1. Create project

bash
mkdir -p ~/tg-cs-bot && cd ~/tg-cs-bot

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown content appears to force a specific language experience without offering an opt-in, alternative locale, or stating that the skill is intentionally region/language-specific. Under the policy, language-only content can be a natural-language policy violation when no user choice or justification is provided.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This document gives detailed operational guidance for ultra-short-term binary-style crypto trading, including bet sizing, payout mechanics, settlement timing, and price-source behavior, but it does not provide any explicit risk warning, responsible-use notice, or loss disclaimer beyond describing that a user can lose the stake. In the context of a customer-service bot knowledge base, this can cause the agent to present speculative trading as routine and frictionless, increasing the chance of facilitating harmful financial behavior without appropriate caution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide instructs users to connect wallets, create events, post deposits, and trade positions where losses can reduce holdings to zero, but it does not provide any warning about financial risk, irreversible blockchain transactions, wallet security, or the need to verify addresses and network details. In the context of an agent skill that may operationalize setup and knowledge-base content for a Telegram bot, this omission could cause users to act on high-risk financial instructions without informed consent or basic safety precautions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code sends both user messages and retrieved knowledge-base context to Anthropic via an external API call, but this file shows no consent flow, minimization, or redaction before transmission. In a customer-service bot context, chats and KB snippets may contain personal, confidential, or proprietary data, so undisclosed third-party transfer creates a real privacy and data-governance risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The bot sends user-facing messages in Chinese at L59 and L72, while other help and error messages are in English. This imposes a language choice on users without opt-in or documented justification, which is a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The handoff flow forwards user identifiers and message content to a separate handoff chat, but the bot does not clearly warn users that their conversation details will be shared with human operators. This creates a privacy and data-handling risk, especially because users may disclose sensitive information assuming they are speaking only to the bot.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code prompts the user to enter a phone number, Telegram verification code, and potentially a 2FA password, which are sensitive authentication inputs. While the login flow is expected, there is no disclosure about credential handling, storage implications of the session, or caution around entering sensitive data into the skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

All user-facing instructions in the file are written in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking audience. The policy requires flagging language or locale constraints when they are imposed without user opt-in or clear justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The title explicitly labels this as an English user guide, and the file contains no language-choice or opt-in language. Under the policy rule for locale constraints, this is a natural-language policy concern unless the English-only scope is justified or users are offered alternatives.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency is specified with only a lower bound, so future installs may resolve to different upstream releases, including buggy or malicious versions introduced after review. In a bot stack that handles API keys, knowledge-base data, and network connectivity, this weakens supply-chain integrity and makes builds non-reproducible.

Content

Scanner excerpt · scripts/requirements.txt (reported line 1)May include surrounding context.

text
anthropic>=0.42.0
chromadb>=0.5.0
sentence-transformers>=3.0.0
python-dotenv>=1.0.0

Unverifiable Dependency: anthropic has 4 known advisory(ies) (CVE-2026-34450 (Claude SDK for Python has Insecure Default File Permissions in Local Filesystem ); CVE-2026-34452 (Claude SDK for Python: Memory Tool Path Validation Race Condition Allows Sandbox); CVE-2026-34450 (The Claude SDK for Python provides access to the Claude API from Python applicat) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
91% confidence
Finding

The manifest does not pin anthropic, so there is no way to verify whether deployment will use a release affected by known advisories. In this skill context, the SDK may process prompts, files, or local data while holding API credentials, so uncertain version selection meaningfully increases risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

ChromaDB is a complex data and service dependency, and using an unpinned version allows unnoticed adoption of releases with new vulnerabilities or breaking security behavior. Because this skill uses RAG and a knowledge base, dependency drift here could directly affect confidentiality or integrity of stored documents and bot behavior.

Content

Scanner excerpt · scripts/requirements.txt (reported line 2)May include surrounding context.

text
anthropic>=0.42.0
chromadb>=0.5.0
sentence-transformers>=3.0.0
python-dotenv>=1.0.0
telethon>=1.37.0

Unverifiable Dependency: chromadb has 8 known advisory(ies) (CVE-2026-45830 (ChromaDB allows any authenticated users to arbitrarily read, write, update, or d); CVE-2026-45833 (ChromaDB has a code injection vulnerability); CVE-2026-45829 (ChromaDB Python project has a pre-authentication code injection vulnerability) +5 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
96% confidence
Finding

ChromaDB has multiple known advisories and the requirement is not pinned, so installs may resolve to a vulnerable release without visibility. Given this bot stores and retrieves customer-service knowledge-base data, a vulnerable vector database could expose or corrupt indexed content and materially affect bot responses.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
93% confidence
Finding

An unpinned sentence-transformers dependency creates non-reproducible builds and increases exposure to upstream package compromise or vulnerable transitive updates. While not inherently dangerous by itself, it broadens the software supply-chain attack surface for the bot deployment.

Content

Scanner excerpt · scripts/requirements.txt (reported line 3)May include surrounding context.

text
anthropic>=0.42.0
chromadb>=0.5.0
sentence-transformers>=3.0.0
python-dotenv>=1.0.0
telethon>=1.37.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

python-dotenv often interacts with environment files containing secrets, and leaving the version unpinned can silently introduce vulnerable behavior into secret-loading workflows. This is especially relevant in a bot deployment that likely stores API tokens and service credentials in environment variables.

Content

Scanner excerpt · scripts/requirements.txt (reported line 4)May include surrounding context.

text
anthropic>=0.42.0
chromadb>=0.5.0
sentence-transformers>=3.0.0
python-dotenv>=1.0.0
telethon>=1.37.0

Unverifiable Dependency: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
92% confidence
Finding

The unpinned python-dotenv dependency makes it impossible to confirm whether deployed versions include known file-handling flaws. Because .env files often contain secrets for Telegram and model APIs, vulnerable behavior here could lead to credential exposure or unsafe file modification in deployment environments.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

telethon is network-facing and handles Telegram sessions and credentials, so unpinned installs can pull in unexpected versions with security regressions or malicious supply-chain changes. The lack of deterministic versioning reduces confidence in the bot's runtime security posture.

Content

Scanner excerpt · scripts/requirements.txt (reported line 5)May include surrounding context.

text
chromadb>=0.5.0
sentence-transformers>=3.0.0
python-dotenv>=1.0.0
telethon>=1.37.0