Back to skill

Security audit

Telegram Tools Suite

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed Telegram automation toolkit, but it handles reusable Telegram session credentials in a way that could expose an account on shared or archived systems.

Install only if you are comfortable giving this package control of a Telegram account. Use a test account, keep the workspace private, do not archive or publish userdata or .env files, and review session-file permissions after login. Treat scheduled sending and bulk joining as account-risking operations even though they are gated by environment variables.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
src/tg_monitor_kit/session_runtime.py:29
Finding

Reusable Telegram session credentials are copied without restrictive file permissions

Content
View full analysis
str: """Path prefix for Telethon session (no .session suffix).""" session_dir = self.project_root / "userdata" session_dir.mkdir(parents=True, exist_ok=True) return str(session_dir / self.session_name) ``` ```python # src/tg_monitor_kit/session_runtime.py:29-41 def create_temp_session_client(cfg: Config, purpose: str) -> TempSessionClient: """Create a TelegramClient bound to a temporary copied session file.""" original_base = cfg.session_file_base original_session = f"{original_base}.session" if not os.path.exists(original_session): raise FileNotFoundError( f"未找到会话文件:{original_session}。" "请先执行登录(tg-monitor auth + tg-monitor login)后再运行对应命令。" ) temp_session_base = f"{original_base}_{purpose}_{uuid.uuid4().hex[:8]}" temp_session = f"{temp_session_base}.session" shutil.copy2(original_session, temp_session) ``` ```python # src/tg_monitor_kit/session_runtime.py:52-68 def cleanup_temp_session_files(temp_session_base: str) -> None: """Best-effort cleanup for temporary Telethon sqlite session files.""" candidates = [ f"{temp_session_base}.session", f"{temp_session_base}.session-journal", f"{temp_session_base}.session-wal", f"{temp_session_base}.session-shm", f"{temp_session_base}-journal", f"{temp_session_base}-wal", f"{temp_session_base}-shm", ] for path in candidates: if os.path.exists(path): try: os.remove(path) except OSError: pass ``` ...[truncated 2801 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
pyproject.toml:10
Finding

Mutable and unverified dependency resolution creates supply-chain exposure

Content
View full analysis
=1.34.0", "openpyxl>=3.1.0", "python-dotenv>=1.0.0", ] ``` ```text # requirements.txt:2-4 telethon>=1.34.0 openpyxl>=3.1.0 python-dotenv>=1.0.0 ``` ```markdown # SKILL.md:93-94 1. **安装依赖**:执行 `pip install -e .` ``` The build dependencies are also open-ended: ```toml # pyproject.toml:1-3 [build-system] requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" ``` ### Technical Analysis All runtime dependencies use lower-bound constraints without upper bounds, exact versions, a lock file, or cryptographic hashes. The documented editable installation command allows pip to resolve whichever compatible versions are available from its configured package index at installation time. Consequently, installing the same audited project at different times can produce materially different executable environments. A future compromised upstream release, unsafe mirror, dependency substitution, or incompatible update could execute with access to the application's Telegram API hash, phone number, and reusable session databases. No evidence was found that the currently named packages are malicious. The vulnerability is the absence of deterministic version and integrity controls, not a confirmed compromise of Telethon, openpyxl, python-dotenv, setuptools, or wheel. ### Attack Path 1. An attacker compromises an upstream package release, a configured package mirror, or the dependency-delivery path. 2. The attacker publishes or substitutes a version satisfying one of the open-ended constraints. 3. A user follows the documented `pip install -e .` installation process. 4. Pip resolves and installs the attacker-controlled or compromised compa ...[truncated 1264 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (54)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill explicitly documents member export and message history export, which are sensitive data-access operations not reflected in the summary description. Hidden or under-disclosed extraction of identities, participation data, and historical content can enable privacy violations and downstream scraping or surveillance.

Content

No source excerpt is available for this finding.

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 · src/tg_monitor_kit/auth.py (reported line 18)May include surrounding context.

python
"""Load settings from environment and optional .env file."""

from __future__ import annotations

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 · src/tg_monitor_kit/config.py (reported line 1)May include surrounding context.

python
"""Load settings from environment and optional .env file."""

from __future__ import annotations

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 · src/tg_monitor_kit/config.py (reported line 75)May include surrounding context.

python
"""Load settings from environment and optional .env file."""

from __future__ import annotations

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 · src/tg_monitor_kit/config.py (reported line 16)May include surrounding context.

python
from dotenv import load_dotenv
    except ImportError:
        return
    env_path = project_root / ".env"
    if env_path.is_file():
        load_dotenv(env_path)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file states that all time and scheduled tasks are based on Beijing Time, which imposes a specific locale/timezone on all users. There is no user opt-in, configuration choice, or clear justification that the skill is limited to a Beijing-region use case.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README documents the send-schedule command as a high-risk operation requiring an enable flag, but this section does not clearly warn that it will automatically send messages to Telegram groups on a schedule and may affect user accounts, recipients, or platform standing. Unlike the join section, it does not include an explicit caution about misuse, rate limits, or terms/policy consequences.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill requests and relies on sensitive environment variables and explicitly describes reading and writing local files, but it does not declare any tool scope or permission boundaries. That makes the operational trust model unclear and increases the chance that a host or user grants broader access than intended, especially given the presence of Telegram credentials and session artifacts.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill provides explicit natural-language instructions for exporting group members and message history, creating a straightforward path to extract personal and conversational data. In the context of a Telegram automation skill with account-level credentials and session files, this substantially raises privacy, compliance, and surveillance risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Line L142 states that all scheduling-related behavior must be interpreted and configured in Beijing time (UTC+8). This imposes a fixed locale/timezone policy on all users, and the file does not offer opt-in, alternatives, or a clear region-specific compliance reason for the restriction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The description advertises broad Telegram automation capabilities such as monitoring, searching groups, bulk joining, and scheduled messaging without clearly stating tight activation boundaries or user-consent constraints in the descriptive surface. In a high-risk automation skill, vague capability framing can enable misuse, mislead integrators about when dangerous functions activate, and normalize spam or abusive account operations even if some env-gated controls exist elsewhere in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This CLI exposes a long-running bulk group-join automation command, and in this entrypoint there is no visible confirmation gate or warning before triggering account-impacting behavior. Given the skill context explicitly includes batch joining and long-running automation against Telegram, this is more dangerous than a generic utility because it can drive abusive actions, trigger anti-spam enforcement, or cause unauthorized account changes at scale if invoked accidentally or by another local process.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code file defines a history command described only as exporting recent group messages, with no confirmation prompt, cautionary print/log message, or inline documentation warning about privacy-sensitive data handling. Exporting chat history can affect user data/privacy, and the visible CLI surface does not disclose that risk here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The raised RuntimeError uses only Chinese text, which forces one locale for users encountering configuration failures. The file provides no language selection, fallback, or documentation justifying a Chinese-only interface.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code persists a detailed inventory of the user's joined Telegram groups/channels to a predictable JSON file on disk. That metadata can reveal sensitive affiliations, interests, and private group membership, and this skill context explicitly involves Telegram automation with sensitive session artifacts, which makes silent local persistence more dangerous than in a generic utility.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code writes monitored message content, sender names, group titles, and timestamps into a local Excel file on a scheduled basis, creating a persistent archive of potentially sensitive communications. In this skill’s context, the tool is explicitly designed for Telegram monitoring and uses a real account session, so silent local retention increases privacy and data-handling risk if the host is shared, compromised, or the operator is unaware of the stored export.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest describes group monitoring/search, bulk joining, and scheduled sending, and notes sensitive session files and resident tasks. This module also persistently exports search results to local .xlsx files, including group IDs, links, member counts, and activity metadata, which is a substantive data retention behavior not reflected in the manifest description for this search capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The runtime automatically sends discovered group metadata and activity-derived information to the Telegram account's 'me' target without any confirmation or explicit runtime consent in this file. Because the daemon can run on startup and on a schedule, it can continuously collect and transmit sensitive reconnaissance data from a user session, increasing privacy and misuse risk if the environment or account is shared or compromised.

Content

No source excerpt is available for this finding.