T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_media.py:84- Finding
Attacker-Controlled Telegram Filename Allows Path Traversal and Arbitrary File Overwrite
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Telegram media helper is not overtly malicious, but it needs review because it can forward chat content and may write downloaded files outside the chosen folder.
Review before installing. Use this only with Telegram chats and bot credentials you trust, and assume target messages may be briefly forwarded. The publisher should fix filename sanitization, constrain or remove arbitrary forwarding, report deletion failures, and avoid passing bot tokens through command-line arguments before routine use.
scripts/fetch_media.py:84Attacker-Controlled Telegram Filename Allows Path Traversal and Arbitrary File Overwrite
scripts/fetch_media.py:43Telegram Bot Token Is Exposed Through Process Arguments
scripts/fetch_media.py:60Temporary Forwarded Messages Are Not Reliably Deleted
The skill’s stated purpose centers on resolving media placeholders, but the documented workflow also forwards messages to another chat and deletes the forwarded copy. That hidden side effect can expose private message contents or metadata to unintended recipients, and the cleanup step can reduce auditability by removing evidence that forwarding occurred.
The forwarding logic can function as an exfiltration mechanism because it copies message content to another chat before download. In this skill's context, forwarding is not merely incidental transport: combined with arbitrary destination selection, it can move sensitive data outside the original conversation boundary.
os.makedirs(out_dir, exist_ok=True)
# Forward the message to get full message object with file info
try:
result = api_call(token, "forwardMessage", {
"chat_id": forward_to,
The skill performs network-capable actions against the Telegram Bot API, but it declares no explicit tool scope or permissions boundary. That makes the skill harder to review and govern, and increases the chance an agent invokes networked behavior unexpectedly with access to sensitive chat identifiers and bot credentials.
The script transmits the bot token and message metadata to Telegram and performs remote API calls without any strong runtime notice or consent mechanism. While contacting Telegram is expected for this skill, the absence of user-facing disclosure can cause operators to unknowingly send sensitive identifiers and access credentials into a network workflow.
The script does more than resolve and download media: it forwards a message and then attempts to delete the forwarded copy. Forwarding changes message visibility and can disclose content to another chat or participant set, which is a side effect beyond the stated purpose of simple media retrieval. In a messaging context, altering message state is security-relevant even if done temporarily.
The optional --forward-to parameter allows forwarding message content to an arbitrary chat, which is broader than necessary for media resolution. That creates a clear exfiltration path: a caller can copy otherwise inaccessible content into a different chat controlled by an attacker, even if the message is later deleted from the destination.
The tool forwards a message and deletes the forwarded copy without a strong warning that it will mutate chat state. This side effect can surprise users, trigger notifications, leave audit traces, or fail to delete in some circumstances, resulting in unintended content exposure.
No suspicious patterns detected.