Back to skill

Security audit

Telegram Stickers

Security checks for vulnerabilities and agentic risk

Overview

This Telegram sticker skill is mostly purpose-aligned, but it needs review because it under-discloses bot-token access and has inconsistent, incomplete documentation.

Review before installing. Only run the import script if you are comfortable with it reading your OpenClaw Telegram bot token and contacting Telegram. Treat sticker tags as trusted input, keep stickers.json free of sensitive conversation text, and expect some advertised features to require manual agent logic or missing files.

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
random-sticker.sh:18
Finding
jq Expression Injection Through User-Controlled Sticker Tags<![CDATA[ ## Vulnerability Details **File Location**: `random-sticker.sh`, lines 18-31 **Vulnerability Type**: jq expression injection **Risk Level**: Medium ### Vulnerable Code ```bash # Build jq filter for multiple tags (OR logic) TAGS=("$@") JQ_FILTER='.collected[] | select(' for i in "${!TAGS[@]}"; do if [ $i -gt 0 ]; then JQ_FILTER+=" or " fi JQ_FILTER+=".tags[]? | contains(\"${TAGS[$i]}\")" done JQ_FILTER+=') | .file_id' # Get all matching stickers and pick random one cat "$STICKERS_JSON" | jq -r "$JQ_FILTER" | sort -R | head -1 ``` ### Technical Analysis Command-line tag values are concatenated directly into jq program source. The script does not encode these values or pass them as data through jq's `--arg` or `--args` interfaces. An attacker can supply quotation marks, jq operators, parentheses, and the jq comment character to terminate the intended `contains()` expression and append a different filter. This is jq-code injection rather than direct shell-command injection: the injected expression executes inside jq and can access any data loaded from `stickers.json`. For example, an argument shaped like: ```text ")) | . # ``` alters the generated jq expression so that complete matching sticker objects can be emitted rather than only their `file_id` fields. ### Attack Path 1. An attacker controls or influences a tag passed to `random-sticker.sh`, either through direct invocation or agent-controlled input. 2. The attacker supplies a crafted value containing jq syntax. 3. The script inserts that value into `JQ_FILTER` without data-safe parameterization. 4. jq evaluates the attacker-modified filter against the complete contents of `stickers.json`. 5. The altered filter may expose additional fields, disrupt sticker selection, generate errors, or consume excessive processing resources. ### Impact Assessment The attacker can manipulate query behavior over the complete local sticker collection. This can disclose sticker metada ...[truncated 388 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not construct jq source code from user input. Pass requested tags as data using `--args`, `--arg`, or `--argjson`. A safer implementation is: ```bash jq -r --args "$@" ' $ARGS.positional as $wanted | .collected[] | select(any(.tags[]?; . as $tag | any($wanted[]; $tag == .))) | .file_id ' "$STICKERS_JSON" | shuf -n 1 ``` Additional hardening should include: 1. Prefer exact tag equality instead of substring matching unless substring behavior is explicitly required. 2. Reject empty tags and enforce a reasonable maximum tag length and argument count. 3. Invoke jq with a fixed, static filter whose structure cannot be changed by input. 4. Add regression tests containing quotes, parentheses, pipes, backslashes, and jq comment characters. 5. Remove the unnecessary `cat` pipeline and pass the file directly to jq. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
import-sticker-pack.sh:13
Finding
Telegram Bot Token Exposed in Process Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `import-sticker-pack.sh`, lines 13-31 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Low ### Vulnerable Code ```bash BOT_TOKEN=$(jq -r '.channels.telegram.botToken' ~/.openclaw/openclaw.json) if [ -z "$1" ]; then echo "Usage: $0 <pack_name>" echo "" echo "Example:" echo " $0 p_8RnHygLOjgFhGENFwoc1_by_SigStick11Bot" echo "" echo "To find pack name: right-click a sticker in Telegram → Copy Link" echo "The URL will be: https://t.me/addstickers/<pack_name>" exit 1 fi PACK_NAME="$1" echo "🔍 Fetching sticker pack: $PACK_NAME" # Get sticker set from Telegram API RESPONSE=$(curl -s "https://api.telegram.org/bot$BOT_TOKEN/getStickerSet?name=$PACK_NAME") ``` ### Technical Analysis The script legitimately requires a Telegram bot token to call `getStickerSet`, and the reviewed request is sent over HTTPS to Telegram's official API endpoint. Therefore, the network transmission itself is necessary for the declared sticker-pack import feature and is not evidence of transmission to an unauthorized third party. However, the token is embedded in the URL passed as a command-line argument to `curl`. While the request is running, the complete URL may be visible through process-inspection tools or captured by process-accounting, diagnostic, tracing, or monitoring systems. Telegram Bot API tokens authorize actions as the associated bot and must be treated as credentials. The script also does not reject a missing token represented by jq as the literal value `null`. ### Attack Path 1. A user starts a sticker-pack import. 2. The script reads the bot token from `~/.openclaw/openclaw.json`. 3. The script starts `curl` with the token embedded in its URL argument. 4. A local principal or monitoring system capable of observing process arguments captures the URL while the request is active. 5. The observer extracts the token and invokes Telegram ...[truncated 781 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Avoid placing the bot token in command-line arguments where local process inspection can reveal it. Recommended hardening measures: 1. Use an HTTP client implementation that constructs the Telegram URL internally rather than receiving the credential-bearing URL through its process arguments. 2. If curl must be retained, provide sensitive configuration through a protected standard-input or file-descriptor mechanism rather than directly in argv, and ensure no verbose tracing is enabled. 3. Restrict `~/.openclaw/openclaw.json` to the owning account, such as mode `0600`, and verify ownership before reading it. 4. Explicitly validate the token before use: ```bash BOT_TOKEN=$(jq -er '.channels.telegram.botToken | select(type == "string" and length > 0)' \ "$HOME/.openclaw/openclaw.json") || { echo "Error: a valid Telegram bot token is not configured" >&2 exit 1 } ``` 5. Ensure application logs, shell tracing, crash reports, and monitoring systems redact Telegram Bot API token paths. 6. Rotate the Telegram bot token immediately if process logs or monitoring records may already contain it. 7. Document that importing packs requires access to the configured Telegram credential and limit execution to trusted local users. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The description presents a broader Telegram sticker assistant with collection, pack import, contextual selection, and message frequency controls. The actual code only performs one narrow subset: auto-tagging entries in a local stickers.json file according to emoji mappings. It does not interact with Telegram, send stickers, import packs, choose stickers based on conversation context, or enforce any messaging limits. Because the implemented behavior is materially narrower and lacks several core declared capabilities, this is a clear description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description promises an active Telegram sticker management and sending capability with smart selection, auto-import, emotion tagging, and rate/frequency controls. The actual code chunk is a local diagnostic/status script. It reads a local JSON file, counts entries, prints a preview and stats, and provides setup instructions if the file is missing or empty. It does not interact with Telegram, send stickers, import packs, choose stickers contextually, or enforce message frequency limits. This is a materially different primary purpose from the declared behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The code only implements one part of the description: importing a sticker pack into a local collection. It fetches a sticker set from Telegram, checks for duplicates, and stores sticker metadata in stickers.json. It does not send stickers, select them contextually, apply emotion-tagging logic, or enforce any frequency/message limits. Additionally, it accesses a Telegram bot token from local config and calls the Telegram API, which is a resource access not reflected in the declared permissions. This is a material mismatch because the declared purpose describes a broader smart sticker agent, while the actual code is just an import utility.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The declared description presents a broader end-to-end Telegram sticker management and sending skill, including collection/import, tagging, contextual choice, and rate limiting. The supplied code chunk is much narrower: it only selects a random sticker from a local JSON dataset based on user-supplied tags and outputs the sticker's file_id. While this partially overlaps with 'select contextually' in a limited tag-filtering sense, the main described capabilities—importing packs, tagging by emotion, sending stickers, and respecting frequency limits—are absent. Therefore the description materially overstates what this code actually does.

Behavior Manipulation

Medium
Category
Prompt Injection
Content
## Usage Philosophy

**Use stickers like humans do:**
- Greetings (goodnight/morning) → always prefer sticker over text
- Celebrations, humor, empathy → great use cases
- Technical answers, reports → skip stickers
- Frequency: ~1 per 2-5 messages (track yourself in agent logic)
Confidence
70% confidence
Finding
Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest says the skill will 'Auto-import packs' and implies automated sticker collection/tagging, but these release notes show auto-collection, tag-based filtering, and integration are still roadmap items. The documented implemented features appear narrower than the manifest's claimed scope, indicating a semantic mismatch between stated skill behavior and actual delivered functionality.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill invokes shell scripts and instructs local file modification, but declares no explicit tool scope or permissions. That creates a least-privilege gap: an agent or reviewer cannot reliably tell what capabilities the skill requires, increasing the chance of unintended shell execution or file writes in environments that auto-wire tool access.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill proposes storing usage analytics and conversation context in local data without notice, minimization, or retention guidance. That can create privacy and compliance risks because conversational context may include sensitive personal data that is unnecessary for sticker selection and could be exposed through local file access or backups.

Behavior Manipulation

Medium
Category
Prompt Injection
Content
## Sticker Usage

When to send:
- Goodnight/morning greetings (always use sticker over text)
- Celebrating success/milestones
- Humorous moments
- Emotional responses (joy, sympathy, encouragement)
Confidence
70% confidence
Finding
Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
The manifest describes collecting and sending Telegram stickers, and importing packs is consistent with contacting Telegram's API. However, this script specifically reads a bot token from ~/.openclaw/openclaw.json, which adds local credential/config access beyond the core sticker-management behavior described in the manifest.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This shell script accesses a credential-like value from ~/.openclaw/openclaw.json and uses it for an external API request. Although the script logs the fetch action later, there is no visible notice that it will read a bot token from local configuration, and no explanatory comment or prompt directed to the user about that sensitive access.

External Transmission

Medium
Category
Data Exfiltration
Content
echo "🔍 Fetching sticker pack: $PACK_NAME"

# Get sticker set from Telegram API
RESPONSE=$(curl -s "https://api.telegram.org/bot$BOT_TOKEN/getStickerSet?name=$PACK_NAME")

# Check if successful
if ! echo "$RESPONSE" | jq -e '.ok' > /dev/null; then
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Intent-Code Divergence

Low
Confidence
87% confidence
Finding
The skill manifest says frequency limits are '2-5 messages', while the release notes state '1 per 5-10 messages'. This is an active contradiction in documentation about a core behavior of the skill, which can mislead users about how often stickers may be sent.

Missing User Warnings

Low
Confidence
85% confidence
Finding
This markdown file explicitly advertises direct `sendSticker` API calls, which are network actions affecting external messaging state. The release notes and quick test instructions present the behavior without any user-facing warning about sending content to Telegram or the operational/privacy implications.

Missing User Warnings

Low
Confidence
76% confidence
Finding
The markdown explicitly tells the agent or operator to update stickers.json manually to track usage, and later shows a command sequence that rewrites the file. There is no accompanying warning that the skill modifies local state or guidance about backups/integrity of that data file.

Static analysis

No suspicious patterns detected.