T09 · Insecure Skill Coding Practices
Warning
- Location
- references/feishu-file-sending-notes.md:57
- Finding
- Overly Broad Temporary Directory Media Allowlist Recommendation## Vulnerability Details **File Location**: `references/feishu-file-sending-notes.md`, lines 57–60 **Vulnerability Type**: Unsafe local file access configuration **Risk Level**: Medium **Complete Snippet**: ```markdown ## Suggested config direction If dynamic files are commonly generated under `/tmp/openclaw/`, consider adding `/tmp/openclaw` or `/tmp` to Feishu `mediaLocalRoots` and restart the gateway. ``` ### Technical Analysis The documentation recommends adding either `/tmp/openclaw/` or the entire system-wide `/tmp` directory to Feishu's `mediaLocalRoots`. Allowlisting `/tmp` violates least-privilege principles because it makes a shared temporary directory eligible as a source for outbound attachments. On multi-process or multi-user systems, `/tmp` may contain files created by unrelated applications or users. Broadly authorizing this directory increases the chance that an unintended, attacker-controlled, or sensitive temporary file can be transmitted through Feishu. The risk may also be increased by symlinks or path-resolution weaknesses if the gateway does not canonicalize paths and reject symbolic-link traversal. This recommendation is unnecessary because `SKILL.md`, lines 43–46, already describes a safer procedure: copy only the intended file into a dedicated allowed workspace before sending it. ### Attack Path 1. An administrator follows the documented recommendation and adds `/tmp` to `mediaLocalRoots`. 2. An unrelated application, local attacker, or compromised process creates or identifies a sensitive or misleading file under `/tmp`. 3. The Agent receives a malicious, ambiguous, or mistaken instruction to send that path as a Feishu attachment. 4. Because `/tmp` is allowlisted, the gateway accepts the file as an authorized media source. 5. The file is transmitted to a Feishu user or group, resulting in unauthorized disclosure. Exploitability depends on the gateway's path canonicalization, symlink handl ...[truncated 560 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the recommendation to add the system-wide `/tmp` directory to `mediaLocalRoots`. 2. Create a dedicated media staging directory, such as `~/.openclaw/workspace/outbound-media/`, accessible only to the gateway account. 3. Copy only the explicitly requested file into that directory before transmission. 4. Resolve and validate the canonical path before sending, and ensure it remains beneath the approved staging root. 5. Reject symbolic links and paths containing traversal components. 6. Apply restrictive directory and file permissions. 7. Generate unpredictable staged filenames to prevent collisions and substitution. 8. Delete staged files after successful delivery or after a short retention period. 9. If a temporary directory is operationally required, use a private per-service directory with restrictive permissions rather than the shared `/tmp` root.
