T09 · Insecure Skill Coding Practices
- Location
execute.sh:32- Finding
Predictable Temporary File Permits Symlink-Based File Truncation
- Content
View full analysis
/tmp/tech_dynamics.tmp echo "### Topic Overview Latest news for $1 --- ### Key Updates - Trends from past 7 days - Key decisions from global tech companies --- ### Potential Impact/Risks - May influence industry direction - Possible regulatory scrutiny --- ### Information Sources - TechCrunch (https://techcrunch.com) --- " rm /tmp/tech_dynamics.tmp ``` ### Technical Analysis The script writes network response data to the fixed, globally predictable path `/tmp/tech_dynamics.tmp`. Shell output redirection opens this path without securely creating it, checking its ownership, or preventing symbolic-link traversal. On systems where applicable symbolic-link protections are absent, disabled, or bypassed by the execution context, another local user can pre-create that path as a symbolic link. When the script executes, the shell follows the link and opens the target with truncation semantics before `curl` runs. Any linked regular file writable by the account running the skill can consequently be emptied or overwritten with filtered response content. The subsequent `rm` does not repair damage to the linked target. Depending on sticky-directory protections and file ownership, removal may fail, but target truncation may already have occurred. Concurrent executions can also interfere with each other because every process uses the same pathname. The temporary file is never read, so its creation provides no functional benefit. ### Attack Path 1. A local attacker predicts the fixed pathname `/tmp/tech_dynamics.tmp`. 2. Before the victim invokes the skill, the attacker creates that pathname as a symbolic link to a file writable by the victim account. 3. The victim runs `execute.sh` with a query argume ...[truncated 883 chars]- Remediation
View remediation
"$tmp_file" ``` ]]>
