T09 · Insecure Skill Coding Practices
Warning
- Location
- references/usage-patterns.md:48
- Finding
- Telegram Updates Are Written to a Predictable Shared Temporary File## Vulnerability Details **File Location**: `SKILL.md:83`; `references/usage-patterns.md:48-54` **Vulnerability Type**: Unsafe temporary-file handling and plaintext storage of sensitive Telegram data **Risk Level**: Medium **Complete Vulnerable Code Snippet**: ```bash # Run background polling through uxc subscribe with offset derived from update_id + 1 # Only one getUpdates consumer can be active for the bot token at a time. uxc subscribe start https://api.telegram.org post:/getUpdates \ '{"timeout":5,"allowed_updates":["message","callback_query"]}' \ --mode poll \ --poll-config '{"interval_secs":2,"extract_items_pointer":"/result","request_cursor_arg":"offset","cursor_from_item_pointer":"/update_id","cursor_transform":"increment","checkpoint_strategy":{"type":"item_key","item_key_pointer":"/update_id"}}' \ --sink file:/tmp/telegram-updates.ndjson ``` The same unsafe sink is presented in `SKILL.md:83`: ```bash uxc subscribe start https://api.telegram.org post:/getUpdates '{"timeout":5,"allowed_updates":["message","callback_query"]}' --mode poll --poll-config '{"interval_secs":2,"extract_items_pointer":"/result","request_cursor_arg":"offset","cursor_from_item_pointer":"/update_id","cursor_transform":"increment","checkpoint_strategy":{"type":"item_key","item_key_pointer":"/update_id"}}' --sink file:/tmp/telegram-updates.ndjson ``` ### Technical Analysis Telegram updates may contain private message text, chat and user identifiers, usernames, callback-query data, and other bot-visible metadata. The documented polling workflow persists all emitted updates to the fixed path `/tmp/telegram-updates.ndjson`. A globally predictable path in a shared temporary directory is unsafe unless the consumer creates the file atomically, rejects symbolic links, verifies ownership, and applies restrictive permissions. Neither the Skill nor its usage guide establishes a restrictive `umask`, creates a private directory, validates an ...[truncated 1791 chars]
- Remediation
- ## Remediation Suggestions - Do not use a fixed filename directly under `/tmp`. - Create a private, per-run directory and restrictive permissions before starting the sink: ```bash umask 077 TELEGRAM_SINK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/telegram-updates.XXXXXX")" TELEGRAM_SINK="${TELEGRAM_SINK_DIR}/updates.ndjson" ``` - Pass `file:${TELEGRAM_SINK}` as the sink only after confirming that the path does not already exist and that its parent directory is owned by the current user. - Ensure the sink creates the destination atomically with mode `0600`, refuses symbolic links, and does not silently append to an attacker-created file. - Prefer an application-private state directory outside a shared temporary directory for long-running subscriptions. - Document retention limits and secure cleanup procedures for update records. - Warn users that Telegram updates may contain personal or confidential information and should not be logged unless persistence is explicitly required.
