T09 · Insecure Skill Coding Practices
- Location
SKILL.md:95- Finding
Workspace Boundary Bypass Through Unsafe String-Prefix Validation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it says, but it can send local files to Telegram with weak confirmation, destination visibility, and cleanup controls.
Review this before installing if your workspace may contain private files. Only use it for explicit file-send requests, verify the exact file and Telegram destination before each send, avoid relying on the documented prefix path check without a safer containment check, and do not let it delete /tmp/ files unless it created them during the same operation.
SKILL.md:95Workspace Boundary Bypass Through Unsafe String-Prefix Validation
SKILL.md:66Telegram Bot Token Exposed Through Process Command-Line Arguments
SKILL.md:100Unscoped Deletion of Files Located Under the Temporary Directory
The trigger text includes a broad catch-all phrase like 'any request to deliver a workspace file via Telegram,' which can cause the skill to activate on loosely related prompts and exfiltrate local files to an external service. In a file-sending skill, overbroad activation materially increases the chance of unintended transmission because the action is inherently high sensitivity.
The skill description does not prominently warn up front that it will transmit local files outside the workspace to Telegram, a third-party service. Without an explicit disclosure before use, users may not understand that invoking the skill causes external data transfer, increasing the risk of accidental data leakage.
This code path explicitly uploads a local file to Telegram's external API. Even though external transmission is the intended function, it is still a real security-sensitive data exfiltration primitive: if the skill is triggered on the wrong file, wrong chat context, or without sufficiently informed consent, local workspace data can be disclosed externally.
FILE_PATH="<resolved absolute path>"
CAPTION="<optional description>"
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument" \
-F chat_id="$CHAT_ID" \
-F document=@"$FILE_PATH" \
-F caption="$CAPTION"
The photo send variant also uploads a local file to Telegram, creating the same outbound exfiltration channel for images and similar media. Images often contain sensitive content or metadata, so direct transmission to an external service remains dangerous even if this is expected behavior.
For photos:
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendPhoto" \
-F chat_id="$CHAT_ID" \
-F photo=@"$FILE_PATH" \
-F caption="$CAPTION"
The instruction to use chat_id from session context and never prompt the user reduces user visibility into the destination and allows the skill to make a sensitive routing decision implicitly. For an exfiltration-capable skill, hiding or assuming the recipient increases the risk of sending files to the wrong chat or to a destination the user did not intend.
3. **No content logging:** Do not log file contents or read file contents for any purpose beyond sending.
4. **Size limit:** Enforce 50 MB maximum (Telegram Bot API limit for documents).
5. **User confirmation:** For files > 10 MB, warn the user about size before sending.
6. **Chat ID:** Use the `chat_id` from the session context. Never prompt the user for a chat ID.
7. **Ephemeral files:** If the file is in `/tmp/`, clean up after sending.
## Behavior Rules
The duplicated document-upload example in the Chinese section confirms the skill's core behavior is external transmission of local files to Telegram. This is a true vulnerability in the sense of a powerful exfiltration capability whose safety depends entirely on strong invocation, consent, and destination controls.
FILE_PATH="<解析后的绝对路径>"
CAPTION="<可选描述>"
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument" \
-F chat_id="$CHAT_ID" \
-F document=@"$FILE_PATH" \
-F caption="$CAPTION"