T09 · Insecure Skill Coding Practices
- Location
scripts/generate-pdf-html.sh:23- Finding
Predictable Temporary HTML File Allows Symlink-Based File Overwrite
- Content
View full analysis
"$HTML_FILE" << HTMLEOF ``` ### Technical Analysis The script uses the fixed path `uploads/report-temp.html` as a temporary HTML file. Shell output redirection follows symbolic links and truncates the resolved target before writing. If another local process or workspace participant can create files in the `uploads` directory, it can replace `report-temp.html` with a symbolic link to another file writable by the account running the Skill. When the Skill executes, the shell follows that link and overwrites the target with generated HTML. The predictable filename also causes a race condition between concurrent report-generation operations. Multiple invocations can overwrite the same temporary file while another Chrome process is reading it, leading to incorrect output or cross-job content exposure. ### Attack Path 1. An attacker obtains write access to `${HOME}/.openclaw/workspace/uploads`. 2. The attacker removes any existing `report-temp.html`. 3. The attacker creates a symbolic link named `report-temp.html` pointing to a sensitive file writable by the OpenClaw account. 4. The user or Agent invokes `generate-pdf-html.sh`. 5. The `cat > "$HTML_FILE"` redirection follows the symbolic link. 6. The target file is truncated and replaced with the generated HTML document. A concurrent-operation variant is also possible: 1. Two report jobs run at approximately the same time. 2. Both jobs write to the same `report-temp.html` path. 3. One job overw ...[truncated 988 chars]- Remediation
View remediation
