Back to skill

Security audit

Telegram Direct Send

Security checks for vulnerabilities and agentic risk

Overview

The skill sends images to Telegram as advertised, but it recommends loading a local .env file in ways that can persistently execute shell code.

Review carefully before installing. Use temporary exports or a proper secret manager instead of sourcing a skill-local .env file, do not add the provided block to shell startup files, and keep the Telegram bot token narrowly scoped to the send command.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:64
Finding

Persistent Shell Code Execution Through Unsafe Environment File Sourcing

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 64–78 and 84–88
Vulnerability Type: Unsafe shell evaluation of a writable configuration file
Risk Level: Medium

Vulnerable Code

bash
### 4. Auto-Load .env (Optional but Recommended)

**For OpenClaw sessions:**
Add to your `~/.bashrc` or `~/.zshrc`:

```bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi
text

The alternative wrapper repeats the unsafe behavior:

```bash
#!/bin/bash
# Load env vars from skill directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
    source "$SCRIPT_DIR/.env"
fi

Technical Analysis

The Bash source command evaluates the complete contents of the specified file as shell code. It does not restrict the file to passive KEY=VALUE configuration entries. Consequently, any command, function definition, command substitution, redirection, or other shell construct inserted into .env will execute with the privileges of the user running the shell.

Recommending that users add this operation to ~/.bashrc or ~/.zshrc expands the risk beyond an individual Skill invocation. The Skill only needs two values, TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID, during a send operation. Executing arbitrary contents from the Skill directory whenever a shell starts is unnecessary for that functionality and violates least-privilege principles.

The project also claims that .env is excluded by .gitignore, but no .gitignore is present in the audited package. This does not directly cause command execution, but it weakens the documented protection against accidental credential disclosure.

Attack Path

  1. A local attacker, compromised process, malicious update, or another component with write access modifies `$HOME/.openclaw/workspace/skills/telegram-direct ...[truncated 1215 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the recommendation to source the Skill’s .env from ~/.bashrc or ~/.zshrc.
  2. Load credentials only for the duration of an explicit send operation.
  3. Parse the configuration as data rather than evaluating it as shell code. Accept only exact keys such as TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID, reject malformed lines, and never use eval.
  4. Prefer a credential manager or OpenClaw-supported secret facility over a plaintext .env file.
  5. If a local secret file remains supported:
    • Require restrictive permissions such as chmod 600 .env.
    • Verify that the file is owned by the current user.
    • Ensure the containing directory is not writable by untrusted users.
    • Add an actual .gitignore entry for .env.
  6. Avoid exporting the Telegram token globally. Pass it only to the process that performs the Telegram request.
  7. Document that shell tracing and command logging must remain disabled because Telegram requires the bot token in the API URL.

T09 · Insecure Skill Coding Practices

Warning
Location
skill.md:64
Finding

Persistent Shell Code Execution Through Unsafe Environment File Sourcing in Duplicate Skill Definition

Content
View full analysis

Vulnerability Details

File Location: skill.md, lines 64–78 and 84–88
Vulnerability Type: Unsafe shell evaluation of a writable configuration file
Risk Level: Medium

Vulnerable Code

bash
### 4. Auto-Load .env (Optional but Recommended)

**For OpenClaw sessions:**
Add to your `~/.bashrc` or `~/.zshrc`:

```bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi
text

The alternative wrapper repeats the unsafe behavior:

```bash
#!/bin/bash
# Load env vars from skill directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
    source "$SCRIPT_DIR/.env"
fi

Technical Analysis

This file duplicates the unsafe instructions in SKILL.md. Bash treats a sourced file as executable shell input, so .env is not confined to declaring the two Telegram variables. Any shell syntax placed in the file executes in the current shell context.

Adding the source operation to shell startup files gives a Skill-controlled file a persistent execution path. This exceeds the minimum access needed to send an image through Telegram, which only requires reading two configuration values at the time of the request.

Maintaining duplicate Skill definitions also creates remediation risk: correcting only one file may leave the other vulnerable version available to users or tooling.

Attack Path

  1. The user follows the instructions in skill.md and adds the provided block to a shell startup file or creates the wrapper.
  2. An attacker or compromised local process with write access changes the Skill’s .env file.
  3. The modified file contains arbitrary shell commands in addition to the expected Telegram variables.
  4. The next shell startup or wrapper invocation sources the file.
  5. The injected commands execute as the affected user and can execute repeatedly w ...[truncated 724 chars]
Remediation
View remediation

Remediation Suggestions

  1. Apply the same correction to both SKILL.md and skill.md, or remove the duplicate file and retain one canonical definition.
  2. Do not instruct users to source Skill-owned configuration from shell startup files.
  3. Replace shell evaluation with a strict configuration parser that recognizes only the two required variable names.
  4. Scope credentials to the individual Telegram request instead of exporting them into every descendant process.
  5. Store the bot token in a supported secret manager where possible.
  6. If .env must be used, require user-only permissions and verify file ownership before reading it.
  7. Add the missing .gitignore with an explicit .env rule and avoid asserting that secrets are ignored unless the protection is actually included.
  8. Add validation and fail closed when required values are missing or malformed.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (42)

Credential Access

High
Category
Privilege Escalation
Confidence
80% confidence
Finding

Instructing users to source a local .env file causes code in that file to execute in the current shell, not just load key-value pairs. If the .env file is modified maliciously or accidentally contains shell commands, this becomes a code-execution and credential exposure risk.

Content

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

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)
source .env

Credential Access

High
Category
Privilege Escalation
Confidence
80% confidence
Finding

This continues the workflow of sourcing .env before making network requests, combining two risks: arbitrary shell execution from the env file and subsequent use of exposed bot credentials. The skill context makes this more dangerous because the loaded secrets are immediately used to transmit data externally.

Content

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

md
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)
source .env

# 3. Send an image
curl -s -X POST \

Credential Access

High
Category
Privilege Escalation
Confidence
81% confidence
Finding

The explicit source .env instruction is a genuine risk because shell sourcing executes file contents. If an attacker can alter the .env file, they can run arbitrary commands in the user's shell and potentially capture or misuse credentials.

Content

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

Option B: Create .env file (recommended)

cp .env.example .env

Edit .env with your values

source .env

text

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

Automatically sourcing a fixed .env path from shell startup creates a persistent code-execution point and exposes credentials into every new shell session. If that file is tampered with, arbitrary commands run automatically, and the Telegram bot token becomes widely available across sessions.

Content

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

bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
84% confidence
Finding

This line is the actual source command executed from shell startup, creating persistent trust in a mutable file under the workspace. In shared or less controlled environments, that can enable startup-time command execution and credential leakage.

Content

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

bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
82% confidence
Finding

The wrapper script sources .env from its own directory, which again executes arbitrary shell content from that file. Because the script may be shared or copied between systems, this pattern can turn a configuration file into an execution vector.

Content

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

md
#!/bin/bash
# Load env vars from skill directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
    source "$SCRIPT_DIR/.env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
82% confidence
Finding

This source command is the concrete execution sink for the local .env file. If the env file is compromised, the script executes attacker-controlled shell before making network requests with valid bot credentials.

Content

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

md
# Load env vars from skill directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
    source "$SCRIPT_DIR/.env"
fi

# Now use the vars

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 21)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 60)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 61)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 63)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 68)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 160)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 21)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 25)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 60)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 61)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 63)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 68)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

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 160)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Instructing users to source a local .env file executes shell syntax from that file in the current shell, not merely loading key-value pairs. If the .env file is modified maliciously or unexpectedly, this can lead to arbitrary command execution and credential exposure in the user's session.

Content

Scanner excerpt · skill.md (reported line 22)May include surrounding context.

bash
# 1. Copy example env file and edit
cp .env.example .env
# Edit .env with your tokens

# 2. Source the env file (or add to ~/.bashrc for auto-load)
source .env

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Again, the issue is the recommendation to source .env, which executes shell content from a file that may be writable by other processes or accidentally contain unsafe commands. That can compromise the user's shell session and any credentials available there.

Content

Scanner excerpt · skill.md (reported line 62)May include surrounding context.

Option B: Create .env file (recommended)

cp .env.example .env

Edit .env with your values

source .env

text

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

Adding a persistent shell startup hook that sources a skill-local .env file causes shell code in that file to execute automatically in future sessions. If the skill directory or .env file is modified, this becomes a persistence and arbitrary code execution vector tied to credentials present in the shell environment.

Content

Scanner excerpt · skill.md (reported line 75)May include surrounding context.

bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

This line is the actual persistent source operation, which executes whatever shell code is present in the skill's .env file on every new shell session. Because the file resides under a workspace/skills path, it may be more exposed to accidental edits or tampering than a dedicated user secret store.

Content

Scanner excerpt · skill.md (reported line 76)May include surrounding context.

bash
# Auto-load telegram-direct-send env vars
if [ -f "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env" ]; then
    source "$HOME/.openclaw/workspace/skills/telegram-direct-send/.env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The wrapper script checks for a local .env and then sources it, which executes arbitrary shell commands if the file contents are malicious. This is especially risky in a reusable helper script because users may run it casually and assume it only loads variables.

Content

Scanner excerpt · skill.md (reported line 87)May include surrounding context.

md
#!/bin/bash
# Load env vars from skill directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
    source "$SCRIPT_DIR/.env"
fi