T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/send_file.sh:2
- Finding
- Unrestricted Transmission of Arbitrary Local Files## Vulnerability Details **File Location**: `scripts/send_file.sh:2-17`; `SKILL.md:8-11, 21` **Vulnerability Type**: Unrestricted local-file access and transmission **Risk Level**: High ### Vulnerable Code `scripts/send_file.sh:2-17` ```bash # Telegram File Sender Script path="$1" caption="${2:-File from OpenClaw}" target="${3}" # e.g., telegram:1234567890 — read from Inbound Context chat_id if [ ! -f "$path" ]; then echo "File not found: $path" exit 1 fi if [ -z "$target" ]; then echo "No target specified. Pass chat_id from Inbound Context as 3rd arg (e.g., telegram:1234567890)" exit 1 fi echo "Sending $path to $target..." openclaw message send --channel telegram --target "$target" --media "$path" --message "$caption" ``` `SKILL.md:8-11, 21` ```markdown 1. Confirm file exists (read path). 2. Read `chat_id` from the `## Inbound Context (trusted metadata)` JSON block in the system prompt (value looks like `telegram:1234567890`). 3. Run `scripts/send_file.sh <path> ['caption'] <chat_id>`. 4. Confirm sent (msg ID logged). **Resolve paths:** workspace rel, abs ok. ``` ### Technical Analysis The script accepts any path supplied as its first argument and verifies only that the path identifies a regular file. It does not canonicalize the path, restrict access to an approved workspace or export directory, reject symbolic-link traversal, or screen sensitive system locations. The skill instructions explicitly permit absolute paths. Consequently, any file readable by the agent process can be supplied to `openclaw message send` and transmitted to Telegram. The implementation also lacks an explicit confirmation step that presents the resolved path and destination to the user before disclosure. The vulnerability does not independently grant filesystem permissions beyond those already held by the agent. However, it breaks least-privilege boundaries by exposing the agent's existi ...[truncated 1149 chars]
- Remediation
- ## Remediation Suggestions 1. Canonicalize the requested path with a platform-appropriate utility before validation. 2. Permit transfers only from explicitly approved workspace or export directories. 3. Verify that the canonical path remains beneath an approved directory boundary. 4. Reject symbolic links, or resolve them and repeat the directory-boundary check on the final target. 5. Deny known sensitive files and directories, including credential stores, private keys, environment files, system configuration, and agent metadata. 6. Require explicit confirmation that displays the canonical file path, file size, and Telegram destination before uploading. 7. Validate the destination against the trusted inbound session context rather than accepting an arbitrary third argument. 8. Run the skill under a dedicated account with minimal filesystem permissions. 9. Record auditable transfer metadata without logging file contents or credentials.
